Keith_W
Major Contributor
I thought I would make a public service post about DSP, because I have noticed that many people don't seem to understand it. I hope this post helps you understand what a DSP product offers you, what the advantages and disadvantages are, and ultimately help you choose what you want or need. This is a complex topic with a lot to say, and I have to keep it brief so that it fits in a forum post and can be easily understood by a general audience. So I am sure I will be criticised for not making certain points by the usually tough ASR crowd. To those people I say: screw you, write your own DSP introduction and see how easy you think it is to condense everything you know into a few posts! No marketing BS in this post, by the end of it you should be able to understand exactly what you are buying when you choose a DSP product.
The most fundamental difference is how DSP products implement DSP. They may use IIR filtering, FIR filtering, or a combination of both (mixed phase).
IIR filtering
IIR, or Infinite Impulse Response filters, are recursive filters, meaning they have feedback. Because of the feedback, the impulse can theoretically go on forever. The structure of an IIR filter is shown above - note that there is a feedforward stage and a feedback stage. Each feedforward/feedback stage has gain coefficients and delays. Without going into the math, each feedforward/feedback stage is a quadratic equation. Because the output of the filter depends on the ratio of the feedforward and feedback stage, an individual set of coefficients is known as a biquad.
Each biquad is a 2nd order filter, meaning it has two poles and two zeros. Therefore, a 2nd order filter (for example, a 12dB/oct Linkwitz Riley LPF) uses one biquad. An 8th order (48dB/oct) uses 4 cascaded biquads. A single PEQ is one biquad. Therefore, how many biquads you have available determines how complex your filter can be. With more biquads, higher-order slopes are possible, and so are more complex corrections.
This is how the filter works: first, the input signal (music) must match the sample rate of the filter. Either the music is resampled, or the filter designed for the music sample rate. At t=0, the first sample is multiplied with b0 and sent to the output. At t=1, the second sample arrives and is multiplied with b0. Meanwhile, the first sample progresses to b1 and a1 with and sent to the output or feedback stage respectively. And so on it goes. t refers to a time period which is 1/sampling rate, so if the sampling rate is 48kHz, t = 0.021ms.
Because IIR is economical with CPU power, it is commonly found on devices which have limited computational capacity such as AVR's and notably, MiniDSP, Danville Nexus, and the like. However, these devices may also have a limited number of biquads, depending on the model. The MiniDSP SHD which I am playing with at the moment has 18 biquads per channel, with a total of 4 channels. Of these, 8 biquads are reserved for the crossover, meaning you have 10 biquads available for PEQ's per channel.
As mentioned, complex corrections are achieved by cascading biquads, however this creates its own issues. Quantisation errors can occur, especially at low frequencies where precision is crucial. Because of the recursive nature, these errors lead to noise accumulation and potential stability issues. Each biquad is minimum-phase, meaning that phase distortion accumulates the more biquads are used. This makes design of a filter with multiple biquads difficult to design if we want to maintain the desired response and avoid unwanted artefacts.
Biquads also have poor portability. Because different manufacturers have different implementations of coefficients, biquads have to be specifically tailored to one model of DSP. The same set of biquads will produce a different output from a different manufacturer. Also related, biquads are tied to the sample rates they were designed for. For example, if a biquad designed for 48kHz were applied at 96kHz, frequency shifts would occur. Specifically, they would double - so a 100Hz LPF becomes a 200Hz LPF.
FIR filtering
FIR, or Finite Impulse Response, has a fundamentally different filter structure. It contains a series of taps. Each tap is a delay-gain pair. If you look closely at the structure of 1 tap, it is exactly the same as one coefficient in an IIR filter. The difference is, IIR filters are recursive and FIR filters are not. This means that if we want to replicate what an IIR filter does with a single biquad, a great number of taps are needed. What this also means is that it is impossible to exactly replicate an IIR biquad, because an infinite number of taps is required.
You may have heard of taps and bins. Taps are time domain entities, and bins are frequency domain entities. For our purpose, it is enough to think of them as equivalent since they can be converted into each other by either inverse FFT or FFT. If you have 65536 taps, you also have 65536 bins. The bin width determines the resolution of the filter. It can be calculated by Fs/n (sampling rate/taps). So if you have 65536 taps and a 48kHz sampling rate, each bin is 0.73Hz wide. This is roughly analogous to a graphic equalizer with 65536 bands of adjustment, with each band being 0.73Hz wide.
This is how it works: at t=0, the first sample is arrived, multipled with the gain coefficient, and sent to the output. At t=1, the second sample arrives, is multiplied, and sent to the output. Meanwhile the first sample has been delayed by 1/Fs before it is multiplied with the second gain coefficient, and on it goes. It keeps going until we reach the filter length which is the total number of taps that we have.
More taps and higher sampling rate means that computational requirements go up. If a filter is 65536 taps long and we have a 48kHz sampling rate, this means we need to hold an absolute bare minimum of (65536/48000) = 1.37 seconds of audio in memory. Multiply that by the number of channels you wish to process, add a bit to prevent starvation, and you can see why we need an ARM processor or a PC to implement FIR filtering with long filter lengths with multiple channels.
This all sounds terrible, so why bother with FIR filtering at all? This is because any filter can be created provided you have enough taps. The same 65536 taps can be used to create very high order filters or very complex corrections with no additional cost (beyond the computing requirements which have already paid). With IIR filtering, you will have to use more biquads to achieve the same outcome, and as we have seen, using more biquads has its own disadvantages. FIR filters can do everything an IIR filter can do, and more. Well, everything except run on low CPU power devices. FIR filters are robust, not prone to instability, and not prone to numerical precision errors. But more importantly, FIR filters can be used to create linear phase filters. More on that shortly.
Mixed Phase
This is achieved by cascading an IIR filter with a FIR filter, sometimes the other way around. Many MiniDSP products (though not all!) are mixed phase. This is done to obtain some of the advantages of FIR filtering (ability to design more complex filters) with IIR filtering (low computational requirements).
The most fundamental difference is how DSP products implement DSP. They may use IIR filtering, FIR filtering, or a combination of both (mixed phase).
IIR filtering
IIR, or Infinite Impulse Response filters, are recursive filters, meaning they have feedback. Because of the feedback, the impulse can theoretically go on forever. The structure of an IIR filter is shown above - note that there is a feedforward stage and a feedback stage. Each feedforward/feedback stage has gain coefficients and delays. Without going into the math, each feedforward/feedback stage is a quadratic equation. Because the output of the filter depends on the ratio of the feedforward and feedback stage, an individual set of coefficients is known as a biquad.
Each biquad is a 2nd order filter, meaning it has two poles and two zeros. Therefore, a 2nd order filter (for example, a 12dB/oct Linkwitz Riley LPF) uses one biquad. An 8th order (48dB/oct) uses 4 cascaded biquads. A single PEQ is one biquad. Therefore, how many biquads you have available determines how complex your filter can be. With more biquads, higher-order slopes are possible, and so are more complex corrections.
This is how the filter works: first, the input signal (music) must match the sample rate of the filter. Either the music is resampled, or the filter designed for the music sample rate. At t=0, the first sample is multiplied with b0 and sent to the output. At t=1, the second sample arrives and is multiplied with b0. Meanwhile, the first sample progresses to b1 and a1 with and sent to the output or feedback stage respectively. And so on it goes. t refers to a time period which is 1/sampling rate, so if the sampling rate is 48kHz, t = 0.021ms.
Because IIR is economical with CPU power, it is commonly found on devices which have limited computational capacity such as AVR's and notably, MiniDSP, Danville Nexus, and the like. However, these devices may also have a limited number of biquads, depending on the model. The MiniDSP SHD which I am playing with at the moment has 18 biquads per channel, with a total of 4 channels. Of these, 8 biquads are reserved for the crossover, meaning you have 10 biquads available for PEQ's per channel.
As mentioned, complex corrections are achieved by cascading biquads, however this creates its own issues. Quantisation errors can occur, especially at low frequencies where precision is crucial. Because of the recursive nature, these errors lead to noise accumulation and potential stability issues. Each biquad is minimum-phase, meaning that phase distortion accumulates the more biquads are used. This makes design of a filter with multiple biquads difficult to design if we want to maintain the desired response and avoid unwanted artefacts.
Biquads also have poor portability. Because different manufacturers have different implementations of coefficients, biquads have to be specifically tailored to one model of DSP. The same set of biquads will produce a different output from a different manufacturer. Also related, biquads are tied to the sample rates they were designed for. For example, if a biquad designed for 48kHz were applied at 96kHz, frequency shifts would occur. Specifically, they would double - so a 100Hz LPF becomes a 200Hz LPF.
FIR filtering
FIR, or Finite Impulse Response, has a fundamentally different filter structure. It contains a series of taps. Each tap is a delay-gain pair. If you look closely at the structure of 1 tap, it is exactly the same as one coefficient in an IIR filter. The difference is, IIR filters are recursive and FIR filters are not. This means that if we want to replicate what an IIR filter does with a single biquad, a great number of taps are needed. What this also means is that it is impossible to exactly replicate an IIR biquad, because an infinite number of taps is required.
You may have heard of taps and bins. Taps are time domain entities, and bins are frequency domain entities. For our purpose, it is enough to think of them as equivalent since they can be converted into each other by either inverse FFT or FFT. If you have 65536 taps, you also have 65536 bins. The bin width determines the resolution of the filter. It can be calculated by Fs/n (sampling rate/taps). So if you have 65536 taps and a 48kHz sampling rate, each bin is 0.73Hz wide. This is roughly analogous to a graphic equalizer with 65536 bands of adjustment, with each band being 0.73Hz wide.
This is how it works: at t=0, the first sample is arrived, multipled with the gain coefficient, and sent to the output. At t=1, the second sample arrives, is multiplied, and sent to the output. Meanwhile the first sample has been delayed by 1/Fs before it is multiplied with the second gain coefficient, and on it goes. It keeps going until we reach the filter length which is the total number of taps that we have.
More taps and higher sampling rate means that computational requirements go up. If a filter is 65536 taps long and we have a 48kHz sampling rate, this means we need to hold an absolute bare minimum of (65536/48000) = 1.37 seconds of audio in memory. Multiply that by the number of channels you wish to process, add a bit to prevent starvation, and you can see why we need an ARM processor or a PC to implement FIR filtering with long filter lengths with multiple channels.
This all sounds terrible, so why bother with FIR filtering at all? This is because any filter can be created provided you have enough taps. The same 65536 taps can be used to create very high order filters or very complex corrections with no additional cost (beyond the computing requirements which have already paid). With IIR filtering, you will have to use more biquads to achieve the same outcome, and as we have seen, using more biquads has its own disadvantages. FIR filters can do everything an IIR filter can do, and more. Well, everything except run on low CPU power devices. FIR filters are robust, not prone to instability, and not prone to numerical precision errors. But more importantly, FIR filters can be used to create linear phase filters. More on that shortly.
Mixed Phase
This is achieved by cascading an IIR filter with a FIR filter, sometimes the other way around. Many MiniDSP products (though not all!) are mixed phase. This is done to obtain some of the advantages of FIR filtering (ability to design more complex filters) with IIR filtering (low computational requirements).
Last edited: