Resample a complex valued buffer without de-interleaving the buffer

I need to perform some sample rate conversion on a buffer holding samples of std::complex<float> samples. I’d like to use the interpolator classes provided by JUCE, e.g. LagrangeInterpolator or CatmullRomInterpolator, however they are designed to interpolate a buffer of non-interleaved float samples. As std::complex samples are interleaved real / imag data I need to de-interleave the buffer, perform the conversion on real and imag part with two interpolator instances and re-interleave the result afterwards.

This seems to be a lot of overhead, especially given the fact that as far as I understand the algorithms it would be perfectly possible to make it templated and directly operate on complex values or SIMD registers, just like the filters from the dsp module. Are there any chances that it gets re-designed to fit the templated style of the dsp module or does anyone know a good third party implementation that can works with interleaved sample buffers?

Maybe not the answer you want, but in case you are using the FFTW, there’s a split complex version of their fft methods, which in some cases is even faster (at least when I tested it with a partitioned convolution). So this might help separating both without costs. However, you’ll have to create the fft-plans yourself, and not use JUCE’s fft-wrapper.

This is interesting, but there is no FFTW involved in my algorithm (nor any other FFT at the point where the data needs to be resampled).

My use case: I’m implementing a software GPS receiver in JUCE and not all RF hardware interfaces support the exact sample rate needed for my GPS acquisition algorithm, so the first step is to resample the data stream. However all RF Interfaces deliver interleaved complex sample buffers, so I need to deal with that…

I just created a pull request here https://github.com/WeAreROLI/JUCE/pull/570#issue-305575138 which implements the proposed changes.

1 Like