I am working on a plug-in where the DSP algorithm has to run at 48k at all times.
I’d need to resample the incoming audio in real-time if it is at a different rate than 48k.
Does anyone know of a third-party library that could handle this task?
I used the resampler code of the speex library in a project that had the same requirement. It’s easy to integrate, linear-phase and quite fast. I had to do some additional fifo buffering for realtime use as the number of output samples can fluctuate per fixed size input buffer.
The problem with using a pair of asynchronous sample rate converters is that they are not guaranteed to keep in sync, it might well happen that after some seconds you don’t get the exact number of samples out as you supplied. It is possible to have a solution where up- and downsampler are synced to each other, once did that for a commercial emulation that required a fixed sample rate.
r8brain is another nice interpolation library. Quality wise it’s just as good as libsamplerate, but a couple years ago it was substantially faster. Mind you for line rate interpolation, i.e. process 1 second of audio every second, libsamplerate was plenty fast too.
In my case using the speex resampler I ended up using a 16 sample circular buffer after resampling to the target rate, doing the processing and resampling back. I did that using arrays of floats + an integer index & 0xf. That was enough to make sure I never run out of samples. It depends on how the samples are fed into your library of choice and how the internal buffering of the resampler works.