DCO's, Anti-Aliasing, and Filters
Harvey Devoe Thornburg
harv23 at leland.Stanford.EDU
Fri Dec 4 20:04:51 CET 1998
Martin Czech writes:
> What does this mean for the usuall 44100 to 48000 Hz conversion?
> Intermediate rate of 7,056,000 Hz ! Now I know why the high quality
> sample rate conversion algos need so long! There are faster algos that
> need less computation time, but they sound not that clean.
>
> Or am I completely wrong? Is there a clean method that avoids these
> extreme high intermediate rates ?
>
Yes. For example, think of what goes on when you do filtering then
downsampling. Suppose your filter is a simple "moving average" filter
eg. you average 10 samples then downsample by 10. By "downsample" I
mean tossing out the 9 intermediate samples. You can either
slide the averaging window one sample at a time, then toss out the 9
intermediate samples, *or* you can move the window 10 samples at a time,
getting the same result with 1/10 the computations. The latter
corresponds to filtering at the lower sampling rate.
The same thing goes for upsampling then interpolation. Instead of
taking a bunch of samples, inserting 9 zeros inbetween, then averaging
the results by a filter whose window moves by 1 sample, you can
get the same results just by hopping the window in 10-sample blocks
and averaging. Again, the goal is to filter (eg. interpolate) at the *lower*
sampling rate!
Now, a moving-average filter, or a box filter, is rather poor for
antialiasing. To get a better filter you also need filter longer than
10 samples. A generalization of this approach for longer filters
is known as "polyphase network". IMHO, the clearest explanation of the
polyphase network is explained in Vaidynathan, _Multirate Systems and
Filter Banks_ (ch. 4 I believe is devoted to polyphase network and
sample rate conversion).
Now, what needs to be done for fixed sample rate conversion?
The diagram as you have explained is Upsample->Filter->Filter->Downsample.
Again, by "upsample" I mean inserting zeros and by "downsample"
tossing out samples. The first Filter corresponds to interpolation;
the second to antialiasing. As these are ideal lowpass filters,
you can replace their combination with the one with the lower cutoff
frequency, leaving Upsample->Filter->Downsample.
Now you can probably see what is done. The Filter need not be computed
at the 7,056,000 Hz sample rate. You can choose to compute the
polyphase network at 44100 or 48000 Hz. In fact, the intermediate sample
rate is never used. If you're worried that you still need to
output the samples at the 7.1MHz rate, this step can be eliminated also
(Vaidyanathan shows how). What you get is the remarkable
fact that the computation time of "ideal" sample rate conversion
is independent of the least common multiple of the sampling rates!
For variable sample rate conversion, such as transposing a sample up and
down, the conversion factor is probably irrational. The idea is similar,
though, and here the technique is called "bandlimited interpolation" or
"sinc interpolation" because the filter is a sin(x)/x function. The
classic paper on this is Smith and Gossett, "A flexible sampling-rate
conversion method", Proc. ICASSP, 1984. An updated, online manuscript
called "Bandlimited Interpolation, Introduction and Algorithm" by Smith
can be found: http://www-ccrma.stanford.edu/~jos/src/src.htm.
Anyway, the theory is moderately complicated, but this is what makes
high-end samplers work so well. I think the Emu samplers have always used
this technique. Most lower end stuff (especially drum machines) uses
linear or cubic (Hermite) interpolation. This gives adequate results
when converting to a higher sampling rate. But they *almost always* mess
up when doing the downconversion. The reason is that since the filter's
cutoff should be the *minimum* of the Nyquist frequencies for the two
rates, you must "stretch out" the interpolation function by a factor
equal to the original sampling rate divided by the lower sampling rate.
--Harvey
> m.c.
>
>
>
>
>
More information about the Synth-diy
mailing list