by Pat Brown
This is Part 5 of the FIR-ward Thinking series. New readers are encouraged to read the earlier installments. Just search on “FIR-ward” in the SynAudCon Members Area.
We live in an age of “bigger is better.” During a recent SynAudCon Forum thread, I suggested that this philosophy is not necessarily true for the length of an FIR filter. As of this writing, the typical filter length supported by DSP is 1024 taps, with some as high as 4096 taps. Why would I not want or need longer FIR lengths? If a manufacturer introduced a 8192 tap FIR in their DSP, wouldn’t I want to pass over competing units and buy it?
Lower Frequency, Longer Time
First, we need a file for practice and experimentation. A loudspeaker measurement could be used, but a simpler file will make some of the important points more obvious. As a reference, please see Figure 1. I created this series of boost filters (ISO octave band center frequencies) in FIRCapture software and saved it as a WAV file. The response could have just as easily been produced by any 9-band parametric EQ. I selected a Q = 6 to minimize the overlap of the filters. This group of filters forms a filter in and of itself, and is not unlike the response of a loudspeaker, less the requisite high pass and low pass response at the frequency extremes. If this were a loudspeaker (let’s pretend that it is), we might wish to equalize the bumps to produce an overall flat response. You may download this file in both WAV and text format if you wish to experiment.
This file gives us a good way to examine the frequency resolution of FIR filters. The Appendices at the end of this article show the use of FIR equalization on the reference file.
Figure 1 – The transfer function of my test file. Courtesy FIRCapture.
Figure 2 – A frequency vs. time view of the same signal. Note the time domain ringing (not delay) of the boost filters. Note also that the ringing is better resolved in this plot (red color approximately equals group delay plot).
Figure 3 – The approximate acoustic wavelengths for the octave centers. No matter what type of filters are used, the time/frequency/wavelength relationships ultimately determine the required resolution of a FIR filter.
The frequency domain display shows the frequency response magnitude, phase, and group delay. Note that the phase and group delay are alternate ways of showing how the filter modifies the time behavior of the signal that passes through it. Since phase is relative, the phase behavior of each bump is the same. From an earlier installment, the minimum phase response of a band pass filter starts positive, goes through zero at the filter’s center frequency, and ends up negative. This phase shift produces frequency-dependent ringing for signals passing through the filter. The duration of this ringing is shown by the group delay plot. Figure 2 is a joint Frequency/Time view of the filter. Figure 3 shows the acoustic wavelengths for each ISO octave center. The relevance? Since the speed of sound is about 1 ft/ms, the wavelength approximately equals the time period for one cycle at each octave center. Wavelength serves as a visual reminder that sound waves span time and space, and so must the response of a filter.
The group delay (GD) will be proportional to the wavelength of the filter frequency, increasing in length with decreasing frequency. While the name implies that the signal is delayed as it passes through the filter, this is a bit misleading. The storage properties of the filter cause ringing, where extra cycles are added to the signal. The GD shows the time span that the boost filter occupies. There is nothing strange happening to produce the very long ringing for the lower frequency bumps. It is inversely proportional to filter frequency (proportional to the wavelength), and a given amount of phase shift will produce a longer group delay with decreasing frequency.
To demonstrate, consider the signal processing chain shown in Figure 4. Let’s pass a tone burst through it and see what happens. Figure 5 shows the result as viewed on a 2-ch oscilloscope. The blue trace is a 1000 Hz 6.5 cycle wavelet. This is one of Don Keele’s shaped tone burst signals. The red trace results from passing it through a 1000 Hz boost filter. Note that the original and filtered signals are in phase, and that the filtered signal has extra cycles. This is time domain ringing. The ringing of a cut filter would span the same amount of time.
Figure 4 – Signal processing setup on a Rane HAL DSP used to demonstrate filter ringing. Courtesy Rane HAL.
Figure 5 – A 6.5 cycle (1 kHz) wavelet. The blue curve is the original signal. The red curve is the signal passed through a 1 kHz 6 dB boost filter (Q = 6). Note that the signal itself is not delayed by the filter block, but the signal envelope (green outline) spans more time.
What must an analog or digital IIR filter do to correct the response? Either must simply produce the opposite magnitude response and phase shift of the bump. Since IIR filters are recursive (utilize feedback) the filtering process happens “on the fly” based on the driving signal (think of a capacitor charging and discharging). As such, there are no low frequency limits on its operation (at least compared to an FIR filter) and it doesn’t introduce a significant amount of processing delay. There will be an output signal so long as there is an input signal, and the filter’s impulse response (theoretically) never decays to zero.
Since a positive group delay is the signature of a narrow band boost filter (Figure 1), a negative group delay is the signature of a cut filter. It means that the phase angle has decreased over the frequency span of the filter. Figure 7 shows a group of IIR filters realized in an EQ block of a popular DSP. Compare the magnitude and phase of each “dip” with the magnitude and phase of each “bump” in figure 1. The equalizer in figure 7 would completely correct the response of my example file.
As a side note, for narrow band signals the GD is not a measure of signal delay, but it does show the time span occupied by the filter’s ringing. Some terms in audio don’t literally mean what their name implies. “Constant voltage” is another example, but that’s a different article.
Min Phase FIR Equalization
In lieu of an IIR filter, let’s consider a minimum phase FIR. Its response can be made identical to the IIR filters produced by the parametric equalizer. An important difference is that the FIR filter’s response exists in totality independent of the signal that drives it. It is an impulse response of finite length, with a corresponding frequency resolution that is dependent on its length. Since T = 1/F, the lower the frequency to be affected, the longer the filter length (time span, more taps) required. Correction of the LF bumps requires introduction of the conjugate of the magnitude and phase at each frequency, which also conjugates the GD. That’s a long time span for the lower frequency bumps. Refer back to Figure 1 for a good visual. Since the filter is minimum phase, the processing delay is very low, just like the IIR filter. The difference is that the FIR filter’s bandwidth is determined by its length (Figure 6), so a very long filter is needed to equalize the lower frequency bumps. This fact is independent of the processing algorithm used to create the filter.
Figure 6 – The interdependence of time and frequency resolution. The frequency domain plot is referenced to the exact arrival time of the pulse (TØ) and the time span extends to T. Since the arrival is a perfect impulse, this FIR acts like a pure delay whose bandwidth is determined by the number of taps.
From Figure 6, a minimum phase FIR filter with 1024 taps and 48 kHz sample rate will have a length of 21 ms. Since T = 1/F, this makes the frequency resolution of the filter about 47.6 Hz. What does this mean? It is the spacing of the frequency domain data points. It is also the lowest frequency that the filter can influence. In actuality, the realized resolution is a bit lower (higher in frequency) since a few periods of the waveform are required to determine frequency.
What would happen if we add more taps? Doubling the filter length will double the frequency resolution, making the frequency spacing of the data points 24 Hz. It will also reduce the LF limit of the filter by one-half, to about 24 Hz. This trend continues. Each doubling of the number of taps extends the filter’s response downward by one octave. So, longer FIRs allow
- The filtering to extend to a lower frequency
- Higher detail in the frequency response of the filter, since the data points are closer together
The minimum phase FIR is a case where more taps could be beneficial, since more taps means that the filter can extend lower in frequency. Since the filter is minimum phase, there is no additional processing delay over an IIR filter. About 4096 taps would be required to flatten my example file. This is far more taps than supported by any current DSP, and it fuels the argument that more taps are needed. Appendix 1 shows a comparison of filter length and vs. frequency resolution for equalizing my reference file using a minimum phase FIR. These filters and plots are exports from Filter Hose, a very powerful FIR generation program.
But wait. There’s more…
Here’s the pushback. A minimum phase FIR behaves just like a minimum phase IIR filter, but requires a sufficient number of taps to affect the lowest frequency of interest. Low frequency equalization requires long filter lengths. But, why use a processor-hungry FIR filter block in your DSP to apply a min phase filter? A properly tuned parametric EQ block (IIR) will produce the same response with better frequency resolution using far fewer system resources (Figure 7). It’s good audio practice to achieve the needed result using as few system resources as possible, and using FIRs for minimum phase equalization is not efficient.
Figure 7 – A parametric EQ block (IIR) can fully correct my example file. It has better frequency resolution than a FIR and requires far fewer DSP resources to deploy. Courtesy Rane HAL.
Let’s next consider a case where the response being corrected is non-minimum phase. I took my reference file and added a second order all pass filter (500 Hz) to the response (Figure 8). This causes a phase shift over the bandwidth of the filter, with minimal effect on the magnitude response. In real life, this all pass behavior can result from the use of a crossover network. A minimum phase FIR cannot compensate for this additional phase shift.
Figure 8 – An all pass filter has been added to the filter set. This results in an overall response that is non-minimum phase. A linear phase FIR is required to correct this response.
Linear Phase FIR to the Rescue!
A linear phase FIR has a two-sided impulse response, where the main signal arrival is centered in the IR (Figure 9). Let’s make the arrival peak relative time zero. The time span preceding the main arrival provides a place for the “negative time” arrivals necessary to conjugate energy arrivals after the main arrival peak. These “pre-delays” are causal in respect to real time, but acausal with respect to the main signal arrival. This allows the filter to compensate for reflections using an opposite “negative time” response. So, if your tap length is 1024 points, a linear phase FIR will place the main arrival at T/2, allowing one-half the filter length to provide the pre-arrivals necessary to conjugate the post arrivals produced in the loudspeaker or room. It also allows the introduction of the negative group delay necessary to compensate for the all pass response of the crossover.
By using 1/2 of the filter length for “negative relative time” corrections, the frequency resolution of the filter is halved. For example, a 1024 tap min phase FIR has 47.6 Hz frequency resolution. The same tap length for a linear phase FIR has a frequency resolution of 95.2 Hz, since up to one-half of the filter length is reserved for phase equalization.
Figure 9 – A linear phase filter reserves up to one-half of the taps for phase equalization/echo cancellation, and reduces the filter’s bandwidth by one octave. The frequency domain plot shown is referenced to the exact arrival time of the pulse (TØ) and the time span extends to T. The example shown is a Dirac pulse, which behaves like a pure delay. Note that the frequency resolution (2/T) has been reduced by moving TØ to T/2.
Are More Taps Better?
As with the minimum phase FIR, it would seem so. The pushback here is that one-half of the filter length is preserved for non-minimum phase equalization. This translates into processing delay (often incorrectly referred to as latency). Unlike the minimum phase FIR, the delay of a linear phase FIR increases as it is lengthened to increase its frequency resolution. This is not due to the speed of the DSP. It results from TF = 1. There is just no escaping that relationship.
Let’s bring up my reference scenario again, but this time for a series of cut filters at the same frequencies as the original boost filters (Figure 10). From earlier, the group delay plot (blue trace) shows the time span of the filter ringing. Note that it appears to be negative, but that just means that the phase shift produced by the filter is increasing over the filter’s bandwidth. It does not mean that a “time advance” has occurred or that the filter’s response is acausal.
There is no getting around the fact that the time span that the filter must influence increases with decreasing frequency, and becomes very long (~40 ms) at the lowest octave center (31.5 Hz). For live sound and many installed sound applications, the long processing delay is unacceptable. A 1024 tap FIR (48 kHz sample rate) has a time span of 21 ms, which means that the processing delay is about 10.5 ms. Increasing the sample rate to 96 kHz does not reduce the processing delay since twice the number of samples must be processed. There’s simply no getting around the fact that 21 ms of time only allows equalization down to about 48 Hz, with a realized frequency resolution of about 3 times 48 Hz or 150 Hz. The series of plots in Appendix 2 demonstrate the time-frequency interdependence of linear phase FIR filters used to equalize my reference file.
It Gets Worse
There is another drawback to linear phase FIR filters. Since ” relative time zero” is centered in the filter’s time span, the frequency resolution is one-half that of a minimum phase FIR. So, if a 1024 tap min phase FIR is effective to 150 Hz, a 1024 tap linear phase FIR will only be effective to 300 Hz. To get back down to 150 Hz would require a 2048 tap filter, which would mean a doubling of the processing delay from about 10.7 ms to 21 ms. For my example file, an 8196 tap FIR would be needed to flatten the entire pass band. The required processing delay is about 85 ms. Ouch!
At face value, the benefit of longer FIR filters appear to be an increase in frequency resolution, resulting in
a. Operation to a lower frequency limit
b. Finer filter detail across its bandwidth
I have already shown that, at least for linear phase FIRs, operation to a lower frequency (more taps) increases the processing delay. This is not due to a lack processing power. It’s due to the interdependence of time and frequency. Low frequencies last a long time and occupy a lot of space. Digital processing can’t change that.
There are 10 octaves in the audible spectrum, so each one occupies about 10% of the whole (log scale). Doubling the filter length, which doubles the processing delay, only buys you the ability to filter about 10% more of the spectrum. Just like doubling the amplifier power to gain 3 dB of level, there is a point of diminishing returns where it is just not worth it. With amplifier power the price is paid in dollars. With linear phase FIRs the price is paid in milliseconds. It could be said that the currency of digital processing is time. You can have some amazing things – if you can wait long enough.
The lowest two octaves (subwoofer range) fall well below the Schroder Frequency for most rooms, where the room modes have a profound effect on the seat-to-seat frequency response. Even if we could make the response “perfect” at a point in space with a linear phase FIR, it will be different at all other seats, so where is the benefit?
Is finer filter detail needed? A 1024 tap filter has data point frequency spacing of about 48 Hz. If that is insufficient for correcting the frequency response, then you are probably trying to equalize something that you shouldn’t, such as comb filtering caused by room reflections. The more “detail” there is in the frequency response, the more “position specific” is the time response, since the details are produced by sound reflecting from various surfaces. Move the mic and the response changes dramatically. A FIR with very high detail will only be appropriate for “correcting” a single point in space. While this might be useful for acoustic echo cancellation for a specific microphone position in a conferencing system , it doesn’t provide a benefit for an audience area. Long FIRs don’t bring much to the picnic for live sound applications.
Do Higher Sample Rates (SR) Help?
That’s the word on the street. Unfortunately it doesn’t pan out. Referring back to Figure 6, the time spacing of the filter taps dt is 1/SR. Multiply this times the number of taps (N) to get the time span (T) of the filter. The frequency resolution (F) is 1/T. These are simple relationships, and they show that if you double the SR the frequency resolution of the filter is reduced by one-half. We made it worse! If you double the SR you now have 2x the number of samples to process, so you have to double the filter length to maintain the same frequency resolution.
Let’s go the other way. Halving the SR will increase the frequency resolution of the filter. But this comes at the expense of high frequency response, which extends to about SR/2. Nyquist-Shannon will not be denied.
None of this changes the required processing delay for a linear phase FIR, which is up to one-half the time span that the filter must influence. Higher (or lower) sample rates don’t change the time, frequency, or wavelength of the signal.
There is no doubt that technology will gift us with longer digital filters. Chips keep improving, and so do the products that use them. Many of us can remember when 16 bit/44.1kHz “CD quality” audio was barely possible. Today it is considered by many to be low resolution. FIRs will follow the same path. But, there are some road blocks to longer filters that have nothing to do with the technology. As I’ve shown, the major one is the processing delay, which is determined by time span that the filter must influence (see Figure 1). In live sound systems, we can only tolerate so much delay. It’s a fuzzy limit, but most would agree that more than about 20 ms for filtering is a pretty long time to wait for a signal. This unavoidable processing delay adds to the latency of the other digital components in the chain, which can easily add another 10 ms or more. We simply have to give up on linear phase equalization at low frequencies due to the time premium, at least for live sound applications.
Mixed-Phase Filters – Yes!
A combination of linear phase FIRs for HF equalization and min phase FIRs for LF equalization seems to be the way to go. These are called “mixed phase” filters and in my opinion they are the future. And while some are starting to consider IIR filters to be passé, there is no denying that they have the widest bandwidth, lowest processing delay, and use the least DSP horsepower of any digital filter. Please don’t take away my Parametric Equalizer blocks!
Having a limitation on the number of taps also means that we must give some thought to what we are trying to correct and why. It’s like only having one spoonful of peanut butter left in the jar. Use it wisely. How does my equalization affect the entire coverage area of the loudspeaker, not just a “sweet spot” where a measurement microphone is placed? The magic of linear phase FIR filters diminishes quickly when multiple seats are considered. They will likely continue to build auditoriums that way for the foreseeable future.
It’s better to have a well-considered application of a 1024 tap FIR, than a sloppy application of a much longer filter. Just as human perception places a practical ceiling on the required sample rate and bit depth for analog-to-digital conversion; time, frequency, wavelength, and delay place a limitation on the benefits of longer FIR filters. In audio, there is always “pushback” on making anything larger, and digital filters are no exception. It is important to let the pushback push back. This keeps things in balance and promotes proper thinking with regard to what really produces better sound vs. what looks good on a spec sheet.
It’s another example of “less can be more.” pb
Appendix 1 – Minimum Phase FIR Filter Examples
Let’s equalize my reference file (minimum phase example)! Here it is again.
Appendix 2 – Linear Phase FIR Filter Examples
Let’s equalize my reference file (non-minimum phase example). Here it is again.
256 Tap Filter
Equalized Transfer Function
512 Tap Filter
Equalized Transfer Function
1024 Tap Filter
Equalized Transfer Function
2048 Tap Filter
Equalized Transfer Function
4096 Tap Filter
Equalized Transfer Function
8192 Tap Filter