[music-dsp] the art of oversampling? aka Newbie question...
Nigel Redmon
earlevel at earlevel.com
Mon Jan 20 15:01:01 EST 2003
Ross gave you the proper order. I'll elaborate a bit so you can see
why. The upside to understanding "why" is that you'll never be
confused again about the order or wether you even need to filter in
special cases.
First, the main reason we upsample/process/downsample is for cases
where we need more bandwidth for the process step, and a typical
reason we need more bandwidth is that the process step is non-linear,
creating higher frequencies that would otherwise alias significantly
into the audio band, so my example here assume that. Upsampling lets
significant alias products stay high enough in the oversampled band
that they can be removed before returning to the original sample rate.
We start with a spectrum that looks something like this--a sample rate
of Fs, and our unaliased audio in the band from 0 to Fs/2, with alias
mirror images extending beyond that:
____ _________ _________
\ | / | \ | / | \
\|/ | \|/ | \...
Fs/2 Fs 2Fs
If we up-sample by a factor of two (by placing a 0 between each
sample), our new Fs (Fs') is the old 2Fs, and some of the alias image
is now below Fs'/2--within the new audio band:
____ _________ _________
\ | / | \ | / | \
\|/ | \|/ | \...
Fs'/2 Fs'
So, we usually need to get rid of the undesired image with a lowpass
filter before further processing (if that undesired image will have
consequences in the processing):
____ _________
\ | | | / | \
\|______|______|/ | \...
Fs'/4 Fs'/2 3Fs'/4 Fs'
Then we can do some processing that might create significant content
up to 3/4Fs'. Anything between Fs'/2 and 3Fs'/4 will alias, mirroring
about Fs'/2 and reflecting back between Fs'/4 and Fs'/4. This gets
harder to draw in ascii, so I won't, but suffice to say that the nice
empty-ish space we made with the lowpass gets filled in.
When we're done processing at the higher rate and it's time to go back
to the original sample rate, we use a lowpass filter again to get back
to something like that third figure, and decimate by retaining every
other sample. If we don't clear out that area first, the content there
will fold back into our audio band at the lower rate (as usual,
because Nyquist said we need to sample at twice the frequency that we
need to reproduce, and after decimating, that band will be
under-represented and alias).
The same applies for 4x and any other oversampling ratio.
More information about the music-dsp
mailing list