Resampler Quality


I was under the impression that the Juce resampler is top-notch, but while messing with the ffmpeg resampler, I came across this site:

The Juce resampler seems like one of the less good options?

Jules - any comment on this? I’d rather stick with working Juce code, but would you recommend ffmpeg (or ffmpeg/sox) over it if I’m using their resampler anyway (do do channel layout work).



It’s not clear whether they’re using the ResamplingAudioSource (which uses a very simple low-pass filter and linear interpolation - i.e. quick-and-dirty) or the LagrangeInterpolator (which is mainly useful for dynamically varying pitches). Neither one was ever designed to be a really high quality fixed-ratio algorithm, which is what they’re testing for. I’m not much of an expert on resampling myself, but if anyone can point me at a free, simple algorithm that’d be a good addition to the library, I’d be interested!


Basically the best (really the best, there is no better!!) affordable re-sampling is to map a sinc-funcition (which needs to be bandlimited (pitched) when the destination sample-rate is lower than source-samplerate) on every source sample-point, and then sum it amplitudes for every destination sample-point. But this can be tricky when the ratio is non-integer.

In real live, you have to shorten the sinc-function by windowing (blackman etc) it to reduce the calculation time.
What i have done is, to build a oversampled + windowed sinc-table, and than take interpolated values from it.
If you promise to make an multi-process version from it (basically you only need to parallelize a for-loop), i can send you the code for free, as a starting point :slight_smile:
I will help to verify the result.

Basically this is what you need, take the dest-samples from the black line (but keep in mind that sinc-functions need to be bandlimited if dest-samplerate is lower)
Are you interested?


Sure, if you have code to share, that’d be awesome.


I sent you a mail.


To help clear the air, I did that test for the SRC site, and used the ResamplingAudioSource. The other one did not exist at the time.


Aleksey Vaneev has released his r8brain SRC code as open source, under a MIT license

On the SRC comparisons website, r8brain seems to be very good, and the documentation cleams that it is also very fast !