This example shows how to create a FIR filter to adjust the magnitude and phase of a full-range loudspeaker. The measurement, for this example, can be downloaded below, and is taken from a 12" + horn install loudspeaker. 12in_2way_ir_44p1k.wav

About measurements

Taking good 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 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.

Terms

  • LF : Low frequency
  • HF : High Frequency
  • LPF : Low pass filter
  • HPF : High pass filter

Step#1

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.

Figure 1

Step#2

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.

Figure 2

Step#3

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.

Figure 3

Step#4

Check the "Flip Polarity" setting and then press "Find Peak." Now most of the phase is near 0 degrees.

Figure 4

Step#5

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.

Figure 5

Step#6

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.

Figure 6

Step#7

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.

Figure 7

Step#8

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.

Figure 8

Step#9

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.

Figure 9

Step#10

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.

Figure 10

Step#11

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.

Figure 11

Step#12

The upper plot can also show the loudspeaker impulse response before and after convolving with this filter design. Since this design has focussed on making the phase flat, much of the energy should pile up to make a sharper impulse, which is what we see.

Figure 12

Step#13

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.

Figure 13

Step#14

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.)

Figure 14

Further comments

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. 

This example shows how to create FIR filters for a 2-way loudspeaker using FIR Designer by Eclipse Audio. The FIR filters include the crossover responses and they linearise the loudspeaker phase everywhere except at the loudspeaker's low frequency roll-off. Measurements, for this example, can be downloaded below, and are taken from a 5" coaxial loudspeaker.

About measurements

Taking good 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 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. When designing filters for multi-way loudspeakers, it is important to maintain the relative acoustic time delay between the drivers in the measurements, as this affects how the loudspeakers acoustically sum in the crossover frequency ranges. Most measurement software can remove the bulk acoustic and sound-card delay from a measurement with an "align to peak" or "auto delay" feature. Do this once, say for the highest frequency driver, then fix the delay for all measurements of all drivers. Finally, when taking measurements with a Microsoft Windows PC, choose a sound-card that has ASIO drivers. Many Microsoft Windows MME/WDM sound-card drivers are notorious for having inconsistent latency, which can cause time offset errors between measurements.

Note that the following terms will be used regularly through out this app note:

  • LF : Low frequency
  • HF : High Frequency
  • LPF : Low pass filter
  • HPF : High pass filter

LF Driver Response

Start FIR Designer. On the "Import" tab, click "Load." Find and select the measurement file for the LF driver and press "Open." Uncheck "Normalise magnitude to max." This may make the magnitude response - the blue line - disappear out of view. Adjust the "Magnitude offset (dB)" value until the lower-frequency, flatter portion of the spectrum - indicated by the arrow - is at approximately 0 dB. Here the offset value is -76 dB. Note this value for use later with the HF driver. In the "Project" menu, select "Save" and save the project as "LF Filter". (The *.fdp file extension is added automatically.) We will load this project file again later.

Figure 1

HF Driver Response

On the "Import" tab, click "Load." Find and select the measurement file for the HF driver and press "Open." Uncheck "Normalise magnitude to max" and enter the "Magnitude offset (dB)" value, noted from the LF driver. Here the value is -76 dB. Using the same value for the LF and HF driver ensures that the relative levels of the two drivers are maintained. Note here that the HF driver has a higher average magnitude, since it is more sensitive than the LF driver. This is typical of HF drivers. In the "Project" menu, select "Save" and save the project as "HF Filter". (The *.fdp file extension is added automatically.) We will load this project again later.

Figure 2

LF Crossover Target

Considering the LF and HF responses above, here we have chosen a crossover frequency of 2 kHz. (Good loudspeaker designs also takes into account other factors including the directivity of the drivers and their maximum level capabilities, but this is beyond the scope of this example.) In the "Project" menu, select "New." Figure 3

Check "Direct Design." The tabs will change to the three shown. On the "Magnitude Design" tab, enable a filter and set it to a 4th order Linkwitz-Riley LPF with linear phase; as shown. Figure 4 Make sure that the "Filter delay" and "Filter length" are long enough to ensure there is essentially no difference between the ideal and windowed filter. Here the defaults of 200 and 400 samples are fine since the sides of the filter, in the upper plot, are well below -100 dB. Also check that the "before windowing" and "after windowing" lines in the lower plot are identical. On the "Export" tab, in the "Format" drop-down, select "FIR Designer target file," click "Save" and save the file as "LF Target". (The file extension *.fdt is added automatically.) In the "Project" menu, select "Save" and save the project as "LF Target". (The file extension *.fdt is added automatically.)

HF Crossover Target

Figure 5

Select the "Magnitude Design" tab and change the filter type to Linkwitz-Riley HPF.

Figure 6

Again, make sure that the "Filter delay" and "Filter length" are long enough to ensure there is essentially no difference between the ideal and windowed filter. On the "Export" tab, in the "Format" drop-down, select "FIR Designer target file," click "Save" and save the file as "HF Target". (The file extension *.fdt is added automatically.) In the "Project" menu, select "Save" and save the project as "HF Target". (The file extension *.fdp is added automatically.)

LF FIR filter design

In the "Project" menu, select "Open" and open the previously saved project file "LF Filter.fdp". Figure 7

On the "Target" tab, select "Design + File." Here a target response is created by combining the upper plot EQ curve with the target file response from the lower plot. Click "Load" and select the target file "LF Target.fdt". The setting "Use Magnitude only" tells FIR Designer to ignore the phase of the loaded target response. Here the phase of the target file doesn't matter since the target file is already linear-phase.

Figure 8

Select the "Magnitude Adjustment" tab. The light blue line in the upper plot is the inverted loudspeaker magnitude and with the target response added. The aim here is to use the magnitude filter prototypes, on the left, to create a composite filter magnitude filter - the green line - that approximately matches the light blue line. Here two LPF filters are used to approximately match the light blue line. More filters could be used, however here we will primarily match the response near 4 kHz, and use the "Auto Mag" tab later to address all the ripples between 200 Hz and 4 kHz.

Figure 9

Select the "Phase Adjustment" tab. 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.) The aim here 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 one 4th order filter is used to move the phase, near 300 Hz, to 0 degrees - shown by the arrow. We will use the "Auto Phase" tab later to address the phase ripples between 300 Hz and approximately 10 kHz.

Figure 10

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 automatic follow the light blue line within a chosen frequency range. Enable the 1st auto mag band between 200 Hz and 4 kHz, as shown. 4 kHz is chosen to be just sufficiently into the LPF stop band - down to -30 dB - to ensure a good summation with the HF driver around the crossover frequency.

Figure 11

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 600 Hz and 6 kHz, as shown. 6 kHz is chosen to be just sufficiently into the LPF stop band - down to just below -30 dB - to ensure a good phase match with the HF driver around the crossover frequency.

Figure 12

Select the "Export" tab. The ideal filter needs to be truncated and windowed to make it practically usable in a processor. 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 150 samples and a Filter length of 500 samples. The lower plot shows both the ideal and the windowed filter. To see the fine difference between the two, look at the "Total Error" on the previous tabs.

Figure 13

The greatest difference or error will always be at the lower frequency end of the filter; here near 300 Hz - indicated by the arrow. Shortening the "Filter delay" and "Filter length" will increase the error, but shortening may be necessary to fit the filter into some processors. On the "Export" tab, in the "Format" drop-down, select the desired output file format, click "Save" and save the file as "LF Filter". (The appropriate file extension is added automatically.) Here we have chosen "Binary file (32 bit, float)" which is used by MiniDSP processors. In the "Project" menu, select "Save" and save the project as "LF Filter". (The file extension *.fdp is added automatically.) The save will prompt to confirm overwriting of the previously created project file.

HF FIR filter design

In the "Project" menu, select "Open" and open the previously saved project file "HF Filter.fdp". Figure 14 On the "Target" tab, select "Design + File." Here a target response is created by combining the upper plot EQ curve with the target file response from the lower plot. Click "Load" and select the target file "HF Target.fdt".

 

Figure 15

Select the "Magnitude Adjustment" tab. Here a HPF and a shelf filter are used to approximately match the light blue line. More filters could be used, however here we will primarily match the response at between near 900 Hz and near 16 KHz, and use the "Auto Mag" tab later to address all the ripples in between.

Figure 16

Select the "Phase Adjustment" tab. Here two 4th order filters are used to move the phase, near 900 Hz and near 9 kHz, to 0 degrees. We will use the "Auto Phase" tab later to address all the phase ripples in between. This particular HF driver has a notch at approximately 11 kHz, possibly due to breakup or possibly due to it's particular coaxial mounting. Since this notch could move in frequency, and since it's quite narrow and not very audible, attempts to flatten it with filtering could sound worse than leaving it alone. Here we will leave it alone.

Figure 17

Select the "Auto Mag" tab. Since we don't want to correct the ~11 kHz notch, enable two auto mag bands - one each side of the notch - as shown. The lower limit of 900 Hz is chosen to be just sufficiently into the HPF stop band - down to -30 dB - to ensure good summation with the LF driver around the crossover frequency.

Figure 18

Select the "Auto Phase tab. Enable the auto phase band between 700 Hz and 9 kHz, as shown. As mentioned previously, we won't attempt to correct the magnitude and phase at the notch frequency.

Figure 19

Select the "Export" tab. To maintain time alignment with the LF driver, it is important to use the same "Filter delay" as used for the LF driver - here 150 samples. Since HF frequencies have shorter wavelengths, HF filtering generally can be done with shorter FIR filters. However it is recommended to start with the LF driver first, to determine the shortest "Filter delay" that will work for both drivers. In the "Format" drop-down, select the desired output file format, click "Save" and save the file as "HF Filter". (The appropriate file extension is added automatically.) Here we have chosen "Binary file (32 bit, float)" which is used by MiniDSP processors. In the "Project" menu, select "Save" and save the project as "HF Filter". (The file extension *.fdp is added automatically.) The save will prompt to confirm overwriting of the previously created project file.

Figure 20

FIR filters inherently cannot make a perfect HP response that goes to -INF dB at DC. To see the LF performance of the filter, check "View range: -100 to 20 dB." Lengthening the "Filter delay" and "Filter length" will make the windowed filter better match the ideal filter at low frequencies.

HF Series Capacitor

In active loudspeaker designs, it is common to use a series capacitor to provide both DC blocking and some LF protection to the HF driver. FIR Designer includes an "IIR Filters" tab where IIR filters that are used inline - analog or digital - can be entered. FIR Designer takes these into consideration in the FIR creation process, so that the combination of IIR and FIR filters gives the desired, filtered loudspeaker response. The "IIR Filters" tab also includes a simple 1st order series capacitor calculator.

Figure 21

Select the "IIR Filters" tab. In the "Series Capacitor Calculator," enter the HF driver impedance and either a capacitor value or frequency, and the calculator calculates the frequency or capacitance. Here for an 8 ohm driver and 5 uF capacitor, the 1st order HPF cutoff is approximately 4 kHz. Enable the first IIR filter and set the filter to a 1st order Butterworth HPF at ~4 kHz. Note how the 1st order filter brings the loudspeaker magnitude response closer to the target, mostly in the 800 Hz to 2 kHz range.

Figure 22

Select the "Magnitude Adjustment" tab. With the IIR filter enabled, the HPF magnitude filter can be lowered in frequency so that the filtered response matches the target at approximately 900 Hz.

Figure 23

Select the "Phase Adjustment" tab. Now with the IIR filter in enabled, the loudspeaker phase has moved further away from the target. Here we add an additional 4th order filter to help bring the filtered phase back to 0 deg. (Each 4th order phase filter has limits of ±90 degrees.) Also, note that less phase shift is needed at 9 kHz to bring the response close to 0 deg.

Figure 24

Select the "Auto Mag" tab. Similar to previously, we use two auto mag bands, however the "Min Freq" of the lower band has moved to 800 Hz.

Figure 25

Select the "Auto Phase" tab. Change the "Min Freq" of the band to 820 Hz so that it starts approximately where the phase is already 0 deg.

Figure 26

Select the "Export" tab. In the "Format" drop-down, select the desired output file format, click "Save" and save the file as "HF Filter w IIR". (The appropriate file extension is added automatically.) Here we have chosen "Binary file (32 bit, float)" which is used by MiniDSP processors. In the "Project" menu, select "Save" and save the project as "HF Filter w IIR". (The file extension *.fdp is added automatically.)

Further comments

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 adjusted by enabling additional linear-phase EQ filters on the "Magnitude Design" tab for both the HF and LF target projects, re-exporting the target filter files, then re-importing the target files into the LF and HF filter projects. 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 9) and the "Auto Phase" tab (see Figure 11). This will, however, require larger "Filter length" and "Filter delay" settings.

Wrapping up[Top][Top]

We hope that this great tutorial from Eclipse Audio will serve its purpose of providing a great step by step for your application. We'd like to thank once again Michael @ Eclipse Audio for his constant support and great software. All credits for writting this great tutorial goes to Eclipse Audio. Make sure to purchase their software and support their impressive effort!

Have fun, and please let us know how you go in our forum.

 


 

Related Products - OpenDRC series