Faster Non-Integer Sample Rate Conversion

A simple bucket-brigade device circuit

Non-Integer Sample Rate Conversion

There are two fundamental kinds of sample rate conversions: Integer Sample Rate Conversion and Non-Integer Sample Rate Conversion.

Using 2 Integer SRC stages to achieve Non-Integer SRC, with factor L/M

Holters-Parker Resampling

Here I’d like to introduce Holters-Parker resampling as a potential alternative to interpolation-based resampling. Holters and Parker start with a filter in the analog domain, to be used for anti-aliasing or anti-imaging similar to the filters used in integer sample rate conversion. Next, Holters and Parker mention the “impulse invariance” method for discretizing analog filters. The idea behind impulse invariance is to derive an expression for the impulse response of the analog system, and then essentially “sample” the impulse response at the sample rate of the digital system.

The BBD “Input Filter” discretized with Holters and Parker’s method. Note that the filter uses different sample rates on each side of the dashed line.

Results

Finally, let’s see how the Holters-Parker resampler compares to the commonly used Sinc interpolation algorithm in libsamplerate. Since I'm primarily interested in speed rather than quality, I've set libsamplerate to use the SRC_SINC_FASTEST option. As it turns out, the results are not even close! On my Linux system running an Intel i7 CPU, the Holters-Parker resampler measures 10-40x faster than libsamplerate depending on the sample rate conversion factor! Further, I don't think my implementation of the Holters-Parker resampler is fully optimal just yet. With a couple more rounds of optimisations, I bet I could have it running even faster!

Conclusion

I hope this discussion of non-integer sample rate conversion and Holters-Parker resampling has been interesting and useful! If you’d like to take a look at the source code for my implementation of the resampler, the code can be found on GitHub. I would greatly appreciate any suggestions on how to improve the quality or performance of the implementation!

--

--

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store