oversampling iir-filter (pre/post filtering)

DSP, Plugin and Host development discussion.
Post Reply New Topic
RELATED
PRODUCTS

Post

Hi there people,

i over-sample a IIR (minimal phase) filter to achieve more precision filter curves near the nyquist frequency.

input -> insert zeros -> (pre-filter) -> IIR-Filter -> (post-filter) -> remove zero places -> output

To my surprise there is no difference if i remove the pre/post-filtering (assuming ideal filters), also i don't detect any aliasing artifacts without pre/post-filtering.

Can't it be, through the nature of IIR-Filters, which not create any additional harmonic content, no pre/post-filtering is required in this case, or do i something wrong, just feeding my processing with the wrong test-signals?

Post

mhh to answer myself, i think my assumption was wrong!
Because of the phase shift, the signal will move into the zero-places... (and so information gets lost)

Post

If you're only doing linear processing then aliases from upsampling will fold back onto the original signal when you downsample. In some cases (EG lowpass) the aliasing will often be well hidden. If you have a sine at 5khz, upsample 2x with zero stuffing, lowpass it, then downsample again, the alias image caused by zero stuffing will fold back onto the 5khz original. If your lowpass was a 24db type, then the alias will be maybe 60dbs down, so it'll just cause a tiny gain change in the original 5khz sine when it's folded back.

Try doing it with a highpass, that'll leave all the aliases to fold back, you'll see some weirdness then.
Chris Jones
www.sonigen.com

Post

With linear processing, it's sufficient to just filter once.. if you up-sample with a proper filter, then down-sampling filter is redundant, because a linear process doesn't create harmonics and the up-sampling filter already removed everything (and similarly if you're down-sampling with a filter, then the images from just zero-stuffing naively for up-sampling don't really matter, because they get removed anyway). But if you don't do any filtering at all (neither up or down sampling), then there will be images created by up-sampling which will alias when down-sampling.

The aliasing frequencies here will be the same as the original frequencies, so it's not like you can actually see it in the normal ways.. your EQ just ends up with (sometimes very) distorted curves.

Post

The thing is to use a proper up sampling filter. Padding with zeros definitely is not the proper way to avoid aliasing. BTW, this is only needed if you are working at 44.1 or 48kHz, otherwise you can remove this additional step.

Post

Miles1981 wrote:The thing is to use a proper up sampling filter. Padding with zeros definitely is not the proper way to avoid aliasing.
Padding with zeros will mirror the spectrum into the new range without altering the existing spectrum at all. Then you can filter out everything above the old Nyquist. Why would that not be a proper way to avoid aliasing?

Post

Because it is additional work, when you can do everything in one pass. And a low-pass filter has additional issues.

Post

Miles1981 wrote:Because it is additional work, when you can do everything in one pass. And a low-pass filter has additional issues.
Well, you normally fold the zero-stuffing into your poly-phase implementation, so you don't actually need build a signal with the extra zeroes at any point, you just need your up-sampling filter to work "as-if" those zeroes were there (producing more output samples compared to input) but conceptually it isn't just "proper way" since it's actually pretty much the ONLY way to up-sample (with or without anti-aliasing).

For example, if you simply duplicated every sample (for 2x) then this is in fact equivalent to zero-stuffing followed by box-car filter. Or if you used linear interpolation, then the filter would be triangular. Unlike high quality anti-alias filters, both of these will significantly distort the original spectrum, but in terms of math, you can still break down the process into zero-stuffing and filtering.

Post

Talking of zero-stuffing, I actually think this is an unnecessary overcompilcation of the subject with a few unnecessary "arcane" points (as mystran put it recently :wink: )

IMHO, a much more intuitive view of resampling is by having an intermediate step in the continuous-time domain. You basically just convolve the initial PCM signal (continuous-time impulse train with varying impulse amplitude) with your preferred lowpass impulse response (windowed sinc being the most obvious example) and then sample it again at the new rate. This results in pretty much the same resampling filter, except that you don't need any "artificial" zero-stuffing.

Post

Z1202 wrote: IMHO, a much more intuitive view of resampling is by having an intermediate step in the continuous-time domain. You basically just convolve the initial PCM signal (continuous-time impulse train with varying impulse amplitude) with your preferred lowpass impulse response (windowed sinc being the most obvious example) and then sample it again at the new rate. This results in pretty much the same resampling filter, except that you don't need any "artificial" zero-stuffing.
Well, except.. mathematically you'd then be treating each sample as a dirac delta, essentially zero-stuffing to a sample-rate limit at infinity.. sort of anyway. :P

Post Reply

Return to “DSP and Plugin Development”