# Resampling irrational or large rational ratios?

Started by July 8, 2005
```Resampling with small integer ratios can be pretty staightforward, like

a rate change of 3/2, upsample by 3 -> LPF -> dec by 2.  However, it's
not as simple when it's a ratio of large integers or some arbitrary new

sample rate.

I started to read this document on resampling:
http://ccrma-www.stanford.edu/~jos/resample/

Is this how others are implementing (in hardware), resampling for these
cases? Multiplying the input samples with a windowed, weighted sinc at
the new sample frequency?

Thanks for any insights,

```
```<bgaughan@airnetcom.com> wrote in message
> Resampling with small integer ratios can be pretty staightforward, like
>
> a rate change of 3/2, upsample by 3 -> LPF -> dec by 2.  However, it's
> not as simple when it's a ratio of large integers or some arbitrary new
>
> sample rate.
>
> I started to read this document on resampling:
> http://ccrma-www.stanford.edu/~jos/resample/
>
> Is this how others are implementing (in hardware), resampling for these
> cases? Multiplying the input samples with a windowed, weighted sinc at
> the new sample frequency?
>
> Thanks for any insights,
>

Yes, the basic synopsis (in the above link) is essentially correct. The
difficulty with sinc() interpolation is the requirement of trying to
perfectly interpolate all the way up to one half of the sampling rate. If
your system has any oversampling at all, then more efficient interpolation
functions may be used. The sinc() function has assymptoticly 1/x tails which
provide for very slow convergence. If you remember your calculus, the error
in summing an alternating series (1st n terms) is less than the magnitude of
the 1st omitted term. Think about how many terms are needed to achieve 90 dB
of signal to noise!  Window functions, such as Kaiser (adjustable) feature
tails with faster than 1/x rolloff and are still nearly flat in the
passband. Some have even used Hermite polys for interpolation. It just
depends on the required accuracy. Since most look (resampling in the signal
processing world with discrete signals) at interpolation errors in the
frequency domain, the window methods provide a very simple means to which to
bound your interpolation errors. Of course with human perception, tolerance
levels of interpolation errors may be a little hard to quantify. But you can
always overkill it a bit.

IHTH,
Clay

```
```Sorry, Brady.  I expected that you'd get a lot more answers here on
comp.dsp than you did on comp.arch.fpga.  But I guess most people are on
vacation or something.

Greg Berchin
```
```bgaughan@airnetcom.com wrote:
>
> Resampling with small integer ratios can be pretty staightforward, like
>
> a rate change of 3/2, upsample by 3 -> LPF -> dec by 2.  However, it's
> not as simple when it's a ratio of large integers or some arbitrary new
>
> sample rate.
>
> I started to read this document on resampling:
> http://ccrma-www.stanford.edu/~jos/resample/
>
> Is this how others are implementing (in hardware), resampling for these
> cases? Multiplying the input samples with a windowed, weighted sinc at
> the new sample frequency?

Sorry, missed this post first time round.

I'm not really an exprt on resampling on hardware, but
from memory, the technique people use in hardware is
called the Farrow interpolator. The advantage of the
Farrow technique over JOS's technique is that it uses
a much smaller table of coefficients.

Erik
--
+-----------------------------------------------------------+
Erik de Castro Lopo  nospam@mega-nerd.com (Yes it's valid)
+-----------------------------------------------------------+
"Hey, I've re-dorkulated." -- Prof. Frink (The Simpsons)
```