[music-dsp] Sample rate conversion
James Chandler Jr
jchandjr at bellsouth.net
Mon Feb 23 12:00:48 EST 2004
----- Original Message -----
From: "Erik de Castro Lopo" <erikd-music-dsp at mega-nerd.com>
> > OTOH, an Allpass 8X upsampler should do its thing with approx 16 multiplies
and
> > 16 adds per sample, with pretty flat frequency response, except for
> > above-original-nyquist harmonics added to the top octave.
>
> Its acutally worse than that. At 8X oversampling you will get alias
> peaks at 1/16 1/8 1/4 1/2 of the new sample rate. When you then pass
> this upsampled signal through your nonlinearity, some of the sum
> and difference frequencies will end up back in the audible band.
Thanks Erik
Maybe one could knock out the alias frequencies with a filter following the
allpass delay bank upsampler (before applying nonlinear effects).
Wonder if the alias peaks would be 'mostly related' to the upsampling ratio, or
if they would be 'tangled up' with the signal frequency?
If the distortion is 'mostly related' to the upsampling ratio, the first loud
'hi freq phase distortion harmonic' might be the third harmonic from original
nyquist (since the phase distortion at higher frequencies tends to 'square wave
distort' signals in the top octave). The phase distortion only gets 'really
awful' on the top half-octave.
If 'mostly related' to the upsampling ratio, after upsampling, a fairly gentle
24 dB/oct IIR lowpass at the original Nyquist, plus a 'pretty wide' IIR notch
filter centered on (original Nyquist * 3) might kill off a good bit of the
distortion without much effect on the passband.
Running a 4th order lowpass plus a 2nd order notch filter, at 8X rate, might be
expensive enough to wipe out efficiencies gained by an 'easy' Allpass
upsampling.
> > A decent downsampling filter might wipe out the top-octave's added harmonics
> > along with the other grunge. If so, perhaps the Allpass upsample idea
wouldn't
> > have excessive warts...
>
> Maybe you could use an IIR for the first stage of the upsampler and
> then use the all-pass sections after that. The first IIR section will
> will almost completely remove all the fs/2 and fs/4 aliasing and then
> the all pass sections have something clean to work with.
>
> I'm even thinking of adding somethng like to to SRC.
Good points.
Here's perhaps not completely stupid idea...
Since the top octave (at original nyquist) appears to be the main problem with a
simple Allpass delay bank upsampler...
Do an initial zero-stuffing 2X upsample, using a pretty good halfband polyphase
filter.
OK, if the original samplerate was 44K, the new samplerate is 88K, with a 22K
passband thanks to the halfband filter. The 'new top octave' up to 44K has been
knocked out.
At this 2X rate, the offending 'new top octave' has been attenuated down into
the noise floor by the halfband filter.
We could do a cheap additional 2X conversion (cumulative upsampling to 4X) using
a single Allpass half-sample delay (running at 2X the original samplerate). Lots
easier than zero-stuffing and running another polyphase halfband filter.
Or we might do an extra 4X conversion (cumulative upsampling to 8X) with three
Allpass delays at 1/4, 1/2, and 3/4 sample delay (running at 2X the original
samplerate). Definitely quicker than upsampling two extra times with polyphase
halfband filters (assuming it doesn't sound awful).
James Chandler Jr.
More information about the music-dsp
mailing list