FIR Filter Design for Loudspeaker Equalization
This tutorial describes how to adjust the magnitude & phase of a full range loudspeaker, using a FIR filter. The measurement used is taken from a 12″ + horn install loudspeaker which can be downloaded here: 12in_2way_ir_44p1k.wav See all FIR Designer supported measurement import file formats.
(This example is based on FIR Designer 1. The latest version of FIR Designer has additional features & functionality not displayed or discussed.)
Taking accurate loudspeaker measurements is difficult. Nearby objects and room acoustics all impact a loudspeaker measurement, and therefore how representative the measurement is of the loudspeaker itself. This example assumes that you are experienced in taking measurements, and that you understand the limitations of your measurement environment and are familiar with concepts including measurement gating/windowing, averaging and time alignment.
Accurate, representative measurements are very important in FIR filter design, especially when using the Auto Mag and Auto Phase features in FIR Designer. Inaccurate measurements can result in these automatic functions adjusting the loudspeaker’s magnitude and phase response in ways that measure well well for one specific location in the room only, and measure poorly and sound worse everywhere else.
- LF : Low frequency
- HF : High Frequency
- LPF : Low pass filter
- HPF : High pass filter
Start FIR Designer.
On the “Import” tab, click “Load.” Find and select the measurement file and press “Open.”
The Import tab is used to load a measurement and adjust its time alignment to remove any bulk delay, and get the phase response in a range we can work with on the following tabs.
The measurement isn’t time aligned and so the upper plot shows significant phase wrapping.
Press the “Find Peak” button. The response is time shifted to bring the peak to time=0.
In this loudspeaker, the HF driver lags the LF driver due to the depth of the horn. When aligned to peak, the measurement has much of its phase relatively close to 180 degrees. We have a few choices in moving the measurement to make it usable.
Use the “Delay” slider to shift the impulse response so that the peak of the first bump is at time=0. This aligns the impulse response to the upper frequency range of the LF driver, however the HF delay, and resulting high phase wrap, is difficult to correct with filtering.
Alternatively, we can align the impulse response to the inverted HF peak.
Check the “Flip Polarity” setting and then press “Find Peak.”
Now most of the phase is near 0 degrees.
Select the “Target” tab.
Here we can specify the magnitude and phase we would like the filtered loudspeaker to have. If the “Design” radio button is selected, the “Target Design” upper section is used to define a magnitude or EQ profile using three segments and a bass shelf. This section assumes we want flat, zero phase.
If the “File” radio button is selected, an impulse response or transfer function can be loaded in the lower section. This “Target File” can be any of the same file formats that can be loaded on the “Import” tab. Here we can use another loudspeaker as the target response, or use a “FIR Designer Target File,” created using FIR Designer in “Direct Design” mode to have the magnitude and phase curve we want (including crossovers).
If the “Design + File” radio button is selected, the upper and lower responses are combined to make the target response.
Leave the “Target” tab set as shown.
Select the “Magnitude Adjustment” tab.
Here we can use common filter prototypes, like parametric bandpass and shelf filters, to shape the loudspeaker response.
The light blue line in the upper plot is the inverted loudspeaker magnitude and with the target response added. The aim is to use the magnitude filter prototypes, on the left, to create a composite magnitude filter – the green line – that approximately matches the light blue line.
Here three filters are used to approximately match the light blue line. More filters could be used, however here we will match the response coarsely and sue the “Auto Mag” tab later to address all the ripples.
The two red lines in the middle plot show the loudspeaker phase, before and after the green curve filter is applied.
The prototype filters can be minimum phase (like regular IIR based filtering), linear phase or maximum phase. It is worth noting the effect of the filtering on the phase (in the middle plot) and choosing filters that result in the phase curve tending towards the target phase. In this example the target phase is flat.
Select the “Phase Adjustment” tab.
Here we can use all-pass filter prototypes to shape the phase of the loudspeaker.
The light red line in the upper plot is the loudspeaker phase, after filtering from previous tabs, then inverted and with the target phase added. (In this example, the target phase is 0 degrees or flat.) This loudspeaker has a 360 degree phase rotation due to the crossover. The aim is to use the phase filter prototypes, on the left, to create a composite phase filter – the green line – that approximately matches the light red line.
Here four filters are used to approximately match the upper plot between 100 Hz and 10 kHz, and therefore move the phase closer to the target phase.
We will use the “Auto Phase” tab later to address the phase ripples.
Select the “Auto Mag” tab.
Again, the light blue line in the upper plot is the loudspeaker magnitude after filtering from the previous tabs, then inverted and with the target response added. Here FIR Designer can calculate a magnitude filter to automatically follow the light blue line within a chosen frequency range.
Move the “Zero Adjust” slider to bring the light blue line close to 0 dB at approximately 60 Hz and 16 kHz. Then enable the first two auto mag bands as shown.
Select the “Auto Phase” tab.
Again, the light red line in the upper plot is the loudspeaker phase, after filtering from all previous tabs, then inverted and with the target phase added. (In this example, the target phase is 0 degrees or flat.) Here FIR Designer can calculate a phase filter to automatically follow the light red line within a chosen frequency range.
Enable the auto phase band between 80 Hz and 10 kHz, as shown. These end points are close to where the light red line is near 0 degrees.
Select the “Export” tab.
The upper plot shows the FIR filter in two ways. The dark green line is a plot of the actual coefficients that will be exported or saved to file. The lighter green line shows the absolute magnitude of these coefficients, in dB.
The ideal filter needs to be truncated and windowed to make it practically usable in a processor. The lower plot shows both the ideal and the windowed filter. With the default “Filter delay” of 200 samples and “Filter length” of 400 samples, there are large differences between the ideal and truncated filter, especially near 100 Hz.
Reducing the differences involves balancing, and likely increasing, the filter delay and the filter length, and possibly changing the choice of window function. The light green dB display in the upper plot can help with this. Generally keeping the filter magnitude at or below -60 dB near the ends of the filter, will keep the error relatively low.
To minimise the error between the ideal and windowed filter, adjust the “Filter delay” and “Filter length” so that the ends, in the upper plot, are below approximately -60 dB.
Here we have chosen a “Filter delay” of 400 samples and a Filter length of 1600 samples.
The upper plot can also show the loudspeaker impulse response before and after convolving with this FIR filter design. Since this design has focused on making the phase flat, much of the energy should pile up to make a sharper impulse, which is what we see.
Since the imported loudspeaker measurement was inverted (on the “Import tab) to move its phase closer to 0 degrees, it may be necessary to invert the FIR filter.
Check the “Invert filter polarity when saving”, then in the “Format” drop-down, select the desired output file format, click “Save” and save the file as “2-way filter”. (The appropriate file extension is added automatically.) Here we have chosen “Binary file (32 bit, float)” which is used by MiniDSP processors.
The greatest difference or error will always be at the lower frequency end of the filter; here near 100 Hz. To see the fine difference between the ideal and truncated filter, look at the “Total Error” on the previous tabs.
Finally, in the “Project” menu, select “Save”, choose a filename and save the project. (The file extension *.fdp is added automatically.)
This example uses the default “Design sample rate” of 48 kHz however the sample rate can be changed at any time. Imported measurements and target responses are stored in the their native sample rate and resampled to the “Design sample rate.”
The magnitude response or “voicing” of the loudspeaker can be further adjusted by creating a target response, using FIR Designer in “Direct Design” mode, exporting the target filter file and importing the target file on the “Target” tab.
The phase rotation, in the low frequency roll-off around 50 Hz, can also be linearised using a combination of filters on the “Phase Adjustment” tab (see Figure 7) and the “Auto Phase” tab (see Figure 9). This will, however, require larger “Filter length” and “Filter delay” settings.[/pane] [/accordion]