[IDEA] Audio resampling class!

Many plugins needs to upsample (or even downsample) audio for internal computation, so an audio resampling class is needed.

Here’s a comparison-site for all algorithms: http://src.infinitewave.ca/

Of course you can include just open source ones:

…more to come !

There is a ResamplingAudioSource class.

I suppose it would be nice to choose different algorithms though.

Sorry, my fault.

BTW it would be great to have at least 3 methods IMHO (fast, normal, accurate)…

OK, just discovered the Oversampling Toolkit by Andrew J:

[quote=“Andrew J”]This toolkit has been developed to help the SynthMaker community develop oversampled DSP effects for audio streams. The toolkit includes three varieties of ASM optimised up- and down-sampling filters.

Please post any comments/issues here.

A port into C++/Juce would be great, IMHO.

Hi forart,

No need to port it, just see Laurent DeSoras’ HIIR C++ code which is referenced in the wiki for the OS toolkit. Note that it only implements the polyphase filters, but you can implement filters with different numbers of coefficients to save on cycles. The triangular & power series filters are pretty trivial.

There’s a few tricks to setting up the HIIR stuff with JUCE audio plugins, so I’ve written myself a wrapper class to make things easier. It lets me set it up with an arbitrary oversampling factor and uses a nice sharp filter for the first upsampling stage and last downsampling stage (it uses cheaper filters for the other stages). The wrapper takes care of the number of stages and sizes all the buffers dynamically when I call its prepare() method. When block processing audio, I just call my upsample() & downsample() methods.

I’ve chosen an implementation which suits my needs and don’t have much time to build a more generic solution as a module - but I’m quite willing to assist and provide a copy of my code to anyone seriously looking at this.

-Andrew J