Possible causes - 96k file will play at 96k with 64 buffer, 192k at 192k with 2048


#1

I am processing files in a windows DLL that plays a file with n-channel data via an ASIO device.

If the file is 96K recording, it will play at 96k sample in a buffer of 64 samples.

If I change the file and sample rate to 192k, the smallest buffer I can use is 2048 otherwise it is getting a lot of processing glitch and crackle.

Any thoughts on what is the most likely source of such inflation in the required buffer, so I can focus my debugging investigations?


#2

Did you test with a release build? Have you benchmarked how long your audio processing code takes to run? Do you do any buffering in a background thread to read the file?


#3

Did you test with a release build?

Yes.

Have you benchmarked how long your audio processing code takes to run?

No.

Do you do any buffering in a background thread to read the file?

No


#4

It would be useful to know how much time it takes for your audio callback to run, to get an understanding if the problem is on your side or somewhere else in the audio system. (Maybe your audio driver starts consuming more time at the 192khz rate.)

Audio file reading (and writing) should pretty much always be done in a different thread, even when using SSD drives, because there are no guarantees how quickly the OS does the I/O. (JUCE has the BufferingAudioReader or BufferingAudioSource classes to help with that.)


#5

It would be useful to know how much time it takes for your audio callback to run, to get an understanding if the problem is on your side or somewhere else in the audio system. (Maybe your audio driver starts consuming more time at the 192khz rate.)

Makes sense. I’ll implement something to capture this.

Audio file reading (and writing) should pretty much always be done in a different thread, even when using SSD drives, because there are no guarantees how quickly the OS does the I/O. (JUCE has the BufferingAudioReader or BufferingAudioSource classes to help with that.)

also useful for me to think about, at present I’m just using the AudioFormatReader class.

Thanks. Much appreciated.