Not a member?

# Discussion Groups | Comp.DSP | IIR filter question

There are 21 messages in this thread.

You are currently looking at messages 1 to .

Is this discussion worth a thumbs up?

0

# IIR filter question - John McDermick - 2011-12-14 17:44:00

```If I split an 8th order fixed-point IIR filter into 4 second-order IIR
filters in cascade, how should the filter coefficients be calculated
so that the overall filter:

1) Doesn't produce ringing when an impulse is applied ?

2) Doesn't produce ringing when a step signal is applied ?

The filters are implemented as Direct Form II Transposed structures.

Is it even possible? If so, what are the limitations?

I intend to use the filter for resampling audio by a factor of P/Q, so
the procedure would be something like this:

1) Given an audio signal, x, sampled at F1 Hz
2) Upsampling: Append (P-1) zeros after each sample in x to create
upsampled signal y
3) Apply filter to y. Filter has a normalized cut-off frequency at Fc
where Fc = min{1/P, 1/Q}. Output of filter is denoted z
4) Downsampling: Keep every Q'th sample in z

```
______________________________

# Re: IIR filter question - Rune Allnor - 2011-12-14 18:36:00

```On 14 Des, 23:44, John McDermick <johnthedsp...@gmail.com> wrote:
> If I split an 8th order fixed-point IIR filter into 4 second-order IIR
> filters in cascade, how should the filter coefficients be calculated
> so that the overall filter:
>
> 1) Doesn't produce ringing when an impulse is applied ?
>
> 2) Doesn't produce ringing when a step signal is applied ?
>
> The filters are implemented as Direct Form II Transposed structures.
>
> Is it even possible? If so, what are the limitations?

It seems you need to read up on basic filter theory.
Ringing is one of the proerties of filters, the
question is not how to avoid it, but how much is
tolerable. You need to

- Understand filters
- Understand specifications
- Come up with a spec which is accetable
- Design a set of filters which meet the spec

Rune
```
______________________________

# Re: IIR filter question - glen herrmannsfeldt - 2011-12-14 19:14:00

```John McDermick <j...@gmail.com> wrote:

(snip)
> I intend to use the filter for resampling audio by a factor of P/Q, so
> the procedure would be something like this:

Deviating slightly from the original question, as I understand it
the 48kHz sampling rate of DAT was supposed to be different enough
(small GCD) to make resampling from 44.1kHz hard.  (CD copying.)

Later, I learned that there are algorithms that do fairly simple
interpolations, and aren't bothered by large P and Q.

Though also changes in computing hardware have made it easier.

-- glen
```
______________________________

# IDIOT::Re: IIR filter question - Vladimir Vassilevsky - 2011-12-14 19:24:00

```Hey idiot,

It doesn't matter in which way the IIR filter is built, and what is your
stupid usage for that filter. As long as the resultant transfer function
has poles with damping less then 1, the response will be oscillatory.

John McDermick wrote:

> If I split an 8th order fixed-point IIR filter into 4 second-order IIR
> filters in cascade, how should the filter coefficients be calculated
> so that the overall filter:

> 1) Doesn't produce ringing when an impulse is applied ?
>
> 2) Doesn't produce ringing when a step signal is applied ?
>
> The filters are implemented as Direct Form II Transposed structures.
>
> Is it even possible? If so, what are the limitations?

> I intend to use the filter for resampling audio by a factor of P/Q, so
> the procedure would be something like this:
>
> 1) Given an audio signal, x, sampled at F1 Hz
> 2) Upsampling: Append (P-1) zeros after each sample in x to create
> upsampled signal y
> 3) Apply filter to y. Filter has a normalized cut-off frequency at Fc
> where Fc = min{1/P, 1/Q}. Output of filter is denoted z
> 4) Downsampling: Keep every Q'th sample in z
>
```
______________________________

# Re: IIR filter question - mnentwig - 2011-12-15 00:52:00

```>> for resampling audio by a factor of P/Q
Try a Lagrange interpolator.

This piece of code
http://www.dsprelated.com/showcode/3.php
does a good job at it and is quite efficient on a CPU.

This
is worth reading. Never mind the pink elephant.
```
______________________________

# Re: IIR filter question - mnentwig - 2011-12-15 01:23:00

```one more thought: the abovementioned methods boil down to FIR polyphase
interpolation. Lagrange, Catmull-Rom etc are different methods to calculate
the FIR coefficients.

Here is another one that -might- give some very good results:
http://www.dsprelated.com/showcode/236.php

function c = gPulseCoefs(u,T,B,P) gives a 2P+1 tap set for "u" fractional
delay. B sets the passband width relative to the sampling time T.

```
______________________________

# Re: IIR filter question - Tim Wescott - 2011-12-15 01:28:00

```On Wed, 14 Dec 2011 15:36:24 -0800, Rune Allnor wrote:

> On 14 Des, 23:44, John McDermick <johnthedsp...@gmail.com> wrote:
>> If I split an 8th order fixed-point IIR filter into 4 second-order IIR
>> filters in cascade, how should the filter coefficients be calculated so
>> that the overall filter:
>>
>> 1) Doesn't produce ringing when an impulse is applied ?
>>
>> 2) Doesn't produce ringing when a step signal is applied ?
>>
>> The filters are implemented as Direct Form II Transposed structures.
>>
>> Is it even possible? If so, what are the limitations?
>
> It seems you need to read up on basic filter theory. Ringing is one of
> the proerties of filters, the question is not how to avoid it, but how
> much is tolerable. You need to
>
> - Understand filters
> - Understand specifications
> - Come up with a spec which is accetable - Design a set of filters which
> meet the spec

Well, a filter doesn't necessarily _have_ to ring -- but an audio filter
that doesn't ring is going to be pretty crappy.

--
Tim Wescott
Control system and signal processing consulting
www.wescottdesign.com
```
______________________________

# Re: IIR filter question - Tim Wescott - 2011-12-15 01:35:00

```On Wed, 14 Dec 2011 14:44:13 -0800, John McDermick wrote:

> If I split an 8th order fixed-point IIR filter into 4 second-order IIR
> filters in cascade, how should the filter coefficients be calculated so
> that the overall filter:
>
> 1) Doesn't produce ringing when an impulse is applied ?
>
> 2) Doesn't produce ringing when a step signal is applied ?
>
> The filters are implemented as Direct Form II Transposed structures.
>
> Is it even possible? If so, what are the limitations?
>
> I intend to use the filter for resampling audio by a factor of P/Q, so
> the procedure would be something like this:
>
> 1) Given an audio signal, x, sampled at F1 Hz 2) Upsampling: Append
> (P-1) zeros after each sample in x to create upsampled signal y
> 3) Apply filter to y. Filter has a normalized cut-off frequency at Fc
> where Fc = min{1/P, 1/Q}. Output of filter is denoted z 4) Downsampling:
> Keep every Q'th sample in z

You are asking two different questions.

You start by asking how to split an 8th-order IIR filter into a cascade
of 4th-order biquads.  That's a fairly mechanical process (getting the
zeros placed intelligently can take a bit of work, but other than that
it's mechanical).  When you're done with this you should have -- barring
details like quantization issues -- a filter with exactly the same
response as what you started.  Correctly cascading 2nd-order sections
into an overall big-order filter doesn't change the overall filter
response.

But then you ask if the resulting filter will have a bunch of
properties.  But those properties are all things that are determined by
the design of the 8th-order filter -- not by the fact that you happen to
be implementing it as a cascade of 2nd-order biquads, or as one, big,
happy 8th-order filter (with, presumably, some really seriously high
precision math).

limitations are, to split an 8-th order filter into 2nd-order biquads:
yes, it's done all the time and while the task isn't completely trivial
it's pretty easy.

limitations are, to make a non-ringing 8th-order filter: sure, you can do
that.  But as everyone else says, it's not something that's going to make
you happy in the end.

--
Tim Wescott
Control system and signal processing consulting
www.wescottdesign.com
```
______________________________

# Re: IIR filter question - Vladimir Vassilevsky - 2011-12-15 02:14:00

```
mnentwig wrote:
>>>for resampling audio by a factor of P/Q
>
> Try a Lagrange interpolator.

Using direct Lagrange interpolation for quality audio is no good idea.
An arbitrary interpolator with BW of 90% of Nyquist and with less then
-100dB worst case artifacts is quite demanding on the CPU.
RBJ wrote several articles on that; IIRC it requires upsampling by
factor ~ 100 before polynomial interpolation.

VLV
```
______________________________

# Re: IIR filter question - mnentwig - 2011-12-15 04:00:00

```>Using direct Lagrange interpolation for quality audio is no good idea.
>An arbitrary interpolator with BW of 90% of Nyquist and with less then
>-100dB worst case artifacts is quite demanding on the CPU.
>RBJ wrote several articles on that; IIRC it requires upsampling by
>factor ~ 100 before polynomial interpolation.

I agree with that: the question is where to draw the line for "quality
audio". One obvious problem with Lagrange and friends is that there is no
direct control over the bandwidth of the passband.

But, reading between the lines, I don't expect the OP needs to meet a 100
dB target. The Catmull-Rom interpolator wouldn't get anywhere close, but
often does a fairly decent job nonetheless, given its simplicity.
It depends on the application.
```
______________________________