Rockbox mail archive
Subject: Better resampling in rockbox
Better resampling in rockbox
I implemented sinc resampling in rockbox: FS#12223.
As I wrote in FS there is (as always) quite some room for improvement. I
have done some limited testing on my Android phone and the code seems to
work. As you can see in the patch you have to define
DSP_USE_SINC_RESAMPLING for it to be actually compiled. Otherwise the
normal linear resampling is used.
I have done some measurements, resampling a 8kHz sine wave from 48kHz to
44.1. Using linear resampling I get some noise (or distortion) spikes as
high as -30dB. The same done with the sinc code and I get generally much
less spikes with much lower energy, with the highest being at about -58dB.
How it works:
As can be shown, a (band-limited) analog signal can be perfectly
reconstructed after ADC / DAC, if it is processed through a low-pass.
Processing through a low-pass means convoluting the samples with a
low-pass impulse response, which is the sinc function (actually it is fc
* sin(pi * fc * t) / pi * fc * t -- with fc being 1.0 for fs/2 if given
in this form).
Now the analog signal at real time t is the superposition of all those
sinc functions scaled by sample value and shifted in time to the sample
time. This is just another way to describe convolution, but shows how we
get the analog signal a real time t, needed for resampling.
This is exactly what this code does: It calculates the superposition of
the time-shifted, scaled sincs. It uses 15 sinc values (and samples) for
Reviews, comments, testing etc. welcome, of course.
Received on 2011-08-10
Page was last modified "Jan 10 2012" The Rockbox Crew