[music-dsp] Resampling 48K -> 44k1 and back usinginterpolation/decimation part 1

Max max at lucit.com
Mon Aug 1 18:40:49 EDT 2005

Thanks Nigel, most helpful. As always this is a case of trying to get the 
best possible quality in the shortest possible time with the maximum 
programmatic convenience.

I will revisit the JOS paper but I seem to recall the symbolism being a 
little taxing, the unfortunate outcome of having done all of my high school 
math at 7.15.a.m. The net result is that I'm operating at the edge of my 
comfort envelope and building a solution will result in a stream of idiotic 
questions ..


----- Original Message ----- 
From: "Nigel Redmon" <earlevel at earlevel.com>
To: "music-dsp" <music-dsp at shoko.calarts.edu>
Sent: Monday, August 01, 2005 11:07 PM
Subject: Re: [music-dsp] Resampling 48K -> 44k1 and back 
usinginterpolation/decimation part 1

> Note that the 147:160 ratio is what you need to do if you restrict 
> yourself to converting by integer ratios. Also note that if you  choose to 
> follow that route, you don't need to go all the way up  first (upsample by 
> 147 times, then downsample by 160)--you can  reorder and interleave the 
> multirate steps for better efficiency  (just make sure that you never drop 
> the bandwidth in intermediate  stages lower than the final requirement).
> If you want to use a windowed sinc interpolator, there is no  requirement 
> that it be restricted to integer ratios. The only reason  that integer 
> ratios are used, traditionally, is that it's most  efficient 
> (computationally) to build a table of the required value  once, then 
> process all the samples. Instead, you could calculate the  values you need 
> per-sample, but that would not be very efficient  (except on a processor 
> that can calculate faster than it can work  with a table).
> However, you can compromise: If you start with a sufficiently  oversampled 
> windowed sinc table, you can interpolate between the  values as needed to 
> implement a fractional rate convertor. The sinc  function is pretty 
> smooth, so the interpolation can be pretty simple-- 
> linear is fine if the table is sufficiently oversampled. Julius Smith 
> describes such an interpolator:
> http://www-ccrma.stanford.edu/~jos/resample/resample.html
> Also, note that you only need one table to go from 44.1k to 48k, or  the 
> other direction (that is, the table would be an oversample  windowed sinc 
> that implements an antialiasing lowpass filter for a  44.1k signal--that 
> is, a 20k-ish lowpass). Finally, note that FIRs  are most efficient (in 
> the sense of number of taps versus cutoff  characteristics) for relatively 
> high cutoff frequencies with respect  to Nyquist, so for 44.1k/48k 
> conversion, it works out to be pretty  economical.
> On Aug 1, 2005, at 8:33 AM, Max wrote:
>> I'm confused for a variety of reasons which I'd like to share  here :-))
>> 1. The comp.dsp FAQ suggests that  "44.1:48 and vice-versa is  pretty 
>> hairy, though, because the lowest whole-number ratio is  147:160.  To do 
>> all that in one go would require a FIR with  thousands of coefficients,"
>> 2. There is no definition of the FIR quality here but the next snip 
>> suggests "we need to design an FIR filter that is flat to 20 KHz,
>> and down at least X db at 24 K ... think about 100 db, since the  max 
>> signal size is roughly +-32767, and the input quantization +-  1/2, so we 
>> know the input had a signal to broadband noise ratio of  98 db at most. 
>> However, the noise in the stopband (20KHz-3.5MHz)  is all folded into the 
>> passband by the decimation in step 3, so we  need another 22 db (that's 
>> 160 in db) to account for the noise  folding.  Thus 120 db rejection 
>> yields a broadband noise equal to  the original quantizing noise."
>> 3. Using FIRScope with a passband upper frequency of 21000 and a  lower 
>> stopband of 22050, passband ripple of 1dB and a stopband  attentuation of 
>> 120dB I can get (apparently) an optimised filter  with 32 taps.
>> 4. If I get FIRScope to optimise a filter with a 150dB stopband 
>> attenuation I can still do this with only 67 taps.
>> Question 1: How do the results in 3 and 4 square with the assertion  of 
>> 'thousands of coefficients' in 1 ?
>> Question 2. In the case of upsampling from 44K1 up to 48K I assume  the 
>> chain is LPF -> L(160) -> M(147) -> LPF ?
>> Question 3. In the case of downsampling from 44K1 up to 48K the  chain is 
>> LPF -> L(147) -> M(160) -> LPF ?
>> where the LPF in question could be the FIR from 3 or 4.
>> Thanks for any help - no one ever seem to deal with this common 
>> requirement in sufficient detail to try a practical implementation.
>> Max n hnjyyyyyyyyyyyy (and Zoot the Cat)
> --
> dupswapdrop -- the music-dsp mailing list and website: subscription info, 
> FAQ, source code archive, list archive, book reviews, dsp links 
> http://shoko.calarts.edu/musicdsp 
> http://ceait.calarts.edu/mailman/listinfo/music-dsp 

More information about the music-dsp mailing list