In this application note, we will explain the difference between FIR ("finite impulse response") and IIR ("infinite impulse response") filtering.
Infinite impulse response (IIR) filters
IIR filters are the most efficient type of filter to implement in DSP (digital signal processing). They are usually provided as "biquad" filters. For example, in the parametric EQ block of a miniDSP plugin, each peak/notch or shelving filter is a single biquad. In the crossover blocks, each crossover uses up to 4 biquads. Each band of a graphic EQ is a single biquad, so a full 31-band graphic EQ uses 31 biquads per channel.
The amount of processing that is required to compute a biquad is relatively small. This is what enables the low-cost miniDSP products to implement a full active crossover with parametric EQ on all input and output channels. The DSP (digital signal processor) on each board can compute a certain number of biquads, and this is the primary thing that determines how many filters are available in each plugin.
The miniDSP biquads can be programmed using the crossover parameters (slope and frequency), the parametric filter parameters (center frequency, gain, and Q), and so on. They can also be programmed with custom filter shapes by directly entering the biquad coefficients - five numbers that are used to compute the biquad output from its input. You can generate these coefficients by using the community-contributed custom biquad programming spreadsheet.
Finite impulse response (FIR) filters
An FIR filter requires more computation time on the DSP and more memory. The DSP chip therefore needs to be more powerful. miniDSP products that support FIR filtering include the OpenDRC and the miniSHARC kit.
FIR filters are specified using a large array of numbers. In the case of the OpenDRC, there are 6144 coefficients (or "taps") per channel. In the case of the miniSHARC, there are a total of 10240 taps assignable to all input and output channels. Generation of this large array of numbers must be done in a separate program, such as rephase, Acourate, and others.
FIR filtering has these advantages over IIR filtering:
- It can implement linear-phase filtering. This means that the filter has no phase shift across the frequency band. Alternately, the phase can be corrected independently of the amplitude. See examples below.
- It can be used to correct frequency-response errors in a loudspeaker to a finer degree of precision than using IIRs.
However, FIRs can be limited in resolution at low frequencies, and the success of applying FIR filters depends greatly on the program that is used to generate the filter coefficients. Usage is generally more complicated and time-consuming than IIR filters.
Examples of FIR and IIR
Here we will provide some simple examples to illustrate the difference between FIR and IIR.
In a two-way crossover filter, the low pass and high pass outputs are sent to the woofer and tweeter respectively and are summed acoustically. We can simulate this behavior electrically - the figure below shows the measured phase response of a summed fourth-order Linkwitz-Riley crossover (24 dB/octave) at 300 Hz in blue. The phase of this crossover shifts by 360 degrees from low frequencies to high frequencies.
Shown in red is the measured output from a crossover with the same amplitude response curves, but implemented with a linear-phase FIR filter. The phase shift is very close to zero across the audio band.
Parametric filters also have a phase shift. Consider a parametric filter with this response:
Below is the measured phase shift of this filter, in blue as implemented by an IIR filter, and in red as implemented by a linear-phase FIR filter. Again, the linear-phase filter has minimal phase shift across the audio band.
Note that sometimes the phase shift shown above is desirable, as it acts to correct phase as well as amplitude errors in (for example) the speaker driver being corrected. FIR filters can implement this curve either way: with the phase shift (minimum phase) or without it (linear phase).
FIR filters are more powerful than IIR filters, but also require more processing power and more work to set up the filters. They are also less easy to change "on the fly" as you can by tweaking (say) the frequency setting of a parametric (IIR) filter. However, their greater power means more flexibility and ability to finely adjust the response of your active loudspeaker.