[ SourceForge.JP | Freeverb3@Savannah | Freeverb3VST.SourceForge.JP ]

A practical guide for digital IIR audio filters

Vladimir L. Vassilevsky, PhD (c) 2003 AbVolt, Ltd.


This article describes the practical way to build digital IIR filters for audio applications. Those filters can be used for equalization and crossover band splitting. See also digital filter design source code in the "Algorithms and Sources" section of this site.

The filter structure

Probably the best and the most common way to implement a filter would be in the form of cascaded sections. First, we consider the building blocks: the first and the second order sections. Each first order section has 3 coefficients: B0, B1 for non-recursive part and A1 for recursive part. Also, the section has a memory array Z of 4 elements. At the each sample, the first order section performs the following operations:

Acc = X*B0 + Z[0]*B1 - Z[1]*A1;
Z[1] = Acc;
Z[0] = X;
X is an input of filter, Acc is an output.

Each second order biquad section has 5 coefficients: B0, B1, B2 for non-recursive part, and A1, A2 for the recursive part. Also, the section has a memory array Z of 4 elements. At the each sample, the second order section performs the following operations:

Acc = X*B0 + Z[0]*B1 + Z[1]*B2 - Z[2]*A1 - Z[3]*A2;
Z[3] = Z[2];
Z[2] = Acc;
Z[1] = Z[0];
Z[0] = X
X is an input of filter, Acc is an output.

The first order section can be viewed as the second order section with B2 = A2 = 0. That may be useful if the filter is implemented in hardware. We are using bilinear transform (BLT) with frequency warping to compute the coefficients for different first and second order filter types.

Multiple cascaded filters

The first order lowpass or highpass section has a slope of 6dB/Octave, and the second order section has a slope of 12dB/Octave. If the better slope is required, you have to cascade several sections. The design of cascaded filters is a pretty wide topic. Here we represent only the main results for Butterworth, Linkwitz-Riley and Bessel types.

Butterworth filter is known as a filter with maximum flat frequency response. It has a good frequency response with no ripple; however the phase response may be quite nonlinear especially for high order filters. Due to that fact, the Butterworth filters with the order of 4 and above have large oscillations in the step response.

Linkwitz-Riley (LR) is common type of filter for crossovers. The main feature of LR is that the sum of high passed and low passed signals has a flat frequency response. LR consists of two identical Butterworth filters in series. Because of that fact, the step and the frequency responses of LR are similar to that of the Butterworth filter.

Bessel filter has a good step response with very little overshoot; however the frequency response is worse then that of Butterworth filter. Bessel filters have near linear phase response. The applications of Bessel are where the phase relations are critical.


All stages of Butterworth filter have the same cutoff frequency Fc. The parameter which is different for the stages is the filter Q. Here is the table for Q for Butterworth up to 6-th order:

1: ---
2: 0.71
3: --- 1.0
4: 0.54 1.31
5: --- 0.62 1.62
6: 0.52 0.71 1.93

If the value of Q is skipped, it means this is a first order section. Otherwise it is a second order section.


LR consists of two identical Butterworth filters in series. Use the same table that is used for Butterworth filter design.


Bessel design is a little bit more complicated, since not only Q but the Fc also differs from the stage to stage. You should multiply the Fc for each stage by the following coefficients:

1: 1.00
2: 1.27
3: 1.32 1.45
4: 1.60 1.43
5: 1.50 1.76 1.56
6: 1.90 1.69 1.60

The corresponding Q values are:

1: ---
2: 0.58
3: --- 0.69
4: 0.81 0.52
5: ---- 0.92 0.56
6: 1.02 0.61 0.51

If the value of Q is skipped, it means this is a first order section. Otherwise it is a second order section.

Note that the digital Bessel filter is designed using BLT. That introduces a phase response error due to the frequency warping. In the other words, the linear phase will be considerably distorted if Fc is higher then Fs/4 approximately. You should use impulse invariant approach or other phase preserving technique to design Bessel filter for high frequencies.

Practical Implementation of IIR filters

A good way to implement audio IIR filters on the PC would be with the use of the floating point. You need the single precision floating point for filter coefficients and double precision for Acc and filter feedback path. Integer calculations are actually slower then the floating point on the PC platform.

If you are using a general purpose integer DSP, you are recommended to have MAC operations with 32x32 bit or better precision. The very minimal accuracy for the satisfactory results in the audio processing is 24x24 bit. On the 16-bit DSPs, you have to implement 32-bit processing in software. Otherwise the sound will suffer quantization noise artifacts especially with the low Fc filters.

The audio processing consumes considerable computing power due to the high sampling rates. For example, the 10-band stereo equalizer with the Fs of 48 kHz takes about 10MIPS from the DSP.

You can also use specialized ICs with the hardware implemented filters. The examples of those ICs are Analog Devices AD1954 or Texas Instruments TAS3004. The ICs have the biquad sections built in. You only have to compute and upload the coefficients for the filters.

The artifacts of IIR filters

The main artifacts of IIR filtering are the quantization noise and the limit cycle oscillations. The truncation or rounding of the IIR accumulator at the output of filter creates quantization noise. This noise is fed into the filter recursive path. The noise is multiplied by the IIR recursive path transfer function. The impact of this noise source is very significant in the low cutoff frequency filters of the second order, since the recursive path gain is proportional to the second power of Fc/Fs ratio. The filter stages with high Q can also suffer from this effect because the gain is proportional to Q.

For the audio applications, the quantization noise can be a problem for crossover, EQ and bass boost filters with the cutoff frequency below 1kHz.

The best way to reduce the quantization noise is improve the arithmetic accuracy. For the practical audio applications, I would recommend to have at least 32 bit data precision in IIR feedback path. That will keep the IIR quantization noise level well below -100dB in most cases.

As for the filter coefficients, the accuracy of 20 bits is good enough for the recursive path. For the non-recursive path, 16 bit coefficients with scaling are sufficient. If the filter is built using the floating point, single precision float accuracy coefficients are adequate for audio applications.

The MAC operation should have at least 52 bits integer or double floating point precision.

If the filter has many stages, the noise contributions of the stages can add, which makes the situation worse. In the multi cascaded filters, it is useful to sort the stages by decreasing Q. Place the stage with the highest Q at the input, then the stage with lower Q, and so on. The idea is to filter out the higher noise of the high Q stage by the next stages with the lower noise. That is an efficient method for highpass, lowpass, bandpass and bandstop type of response. The approach works very well for Butterworth, Bessel and especially Chebyshev filters. For the elliptic filters, you also have to optimize the locations of poles and zeroes for each stage.

The disadvantage of placing high Q stages in front is a possibility of an overflow due to the high gain for integer filter implementations. This is not an issue if the filters are implemented in the floating point arithmetic.

The other way to reduce the quantization noise is the noise shaping. Noise shaping is feeding the accumulator truncation error back into the filter. That allows for better SNR at low frequencies for the cost of an increased noise at the high frequencies. The noise shaping with higher order error feedback can significantly improve the SNR, however the added complexity and limited performance makes it less attractive, then the increased precision arithmetic.

The limit cycles are the low amplitude oscillations which may occur in IIR filters. The reason for those oscillations is a finite precision of the arithmetic operations. The limit cycle existence depends on the particular filter coefficients and the input data. The filters with high Q, low Fc/Fs ratio and the rounding of the accumulator at the output rather then with truncation have a higher probability of a limit cycle behavior.

Usually the amplitude of limit cycle oscillations does not exceed several LSBs. The methods to avoid the limit cycles are the following:

Improve the precision of filter arithmetic
Implement a center clipping nonlinear function
Dithering (adding a random noise with the amplitude of several LSBs)
Gating: blocking the filter if the energy of the signal is below a certain limit

Recommended Reading

"Digital Filters: Basics and Design" Dietrich Schlichtharle Springer Verlag ISBN 3-540-66841-1

Valid XHTML 1.1 Valid CSS! SourceForge.JP

[ SourceForge.JP | Freeverb3@Savannah | Freeverb3VST.SourceForge.JP ]