How to correct phase for IIR filters

Hello,

I have a Hypex Fusion plate amplifier that covers digital crossover and EQ duties. It can only apply IIR filters.

This works out well, as I wish to only use IIR filters as it avoids 'Pre -ringing' that occurs in FIR filters when you apply large amounts of EQ.

Here is an example of what pre-ringing sounds like:
This is the sound of 4 drum hits with no pre-ringing followed by 4 with pre-ringing. (I assume this is huge amounts of pre-ringing to make it so audiable)
ShortTest.flac - Google Drive

My application requires large amounts of EQ. (horn speaker).

I have set the crossover up, and EQed it. It sounds quite good.



For fun, I would next like to try and correct the phase of the speaker, to see what it does to the sound but without using FIR filters. (again due to the pre-ringing effect).

I appreciate that many will feel the phase will be in-audiable, but I would like to try anyway

I have read somewhere that this can be done by adding 'all pass' filters, which delays the signal so phase is correct. Can anyone link to or explain how this is done/calculated?

I can apply all pass filters in the Hypex fusion, or I can use any PC software you suggest.

Thanks!
 
While it is possible to EQ delay using only IIR all-pass filters, they are typically the wrong tool for the job.

The problem that you want to solve is that the group delay has peaks, and at higher frequencies is less than at lower ones as you move across crossover points. To EQ or flatten the group delay, what you need is a compensating delay curve that INCREASES with frequency and has dips. This cannot in general by provided by IIR group delay EQ.

So, the best way to EQ delay (or phase if you wish to think of it that way) is via FIR filtering.
 
Linear phase implies symmetry before and after the peak. Pre-ring is only implied if there is also post-ring. Some filters don't ring at all (well, not very much), e.g. Bessel lowpass filters.

Lang describes an allpass EQ technique here: https://pdfs.semanticscholar.org/3534/e51b187f8a2f4a9cb462822d16ab8239c8d5.pdf. I also have a version of FDLS (Frequency Domain Least Squares) that does the same. Lang's method generally does a better job, but FDLS may be easier to understand and implement.

- Greg Berchin
 
Linear phase implies symmetry before and after the peak. Pre-ring is only implied if there is also post-ring. Some filters don't ring at all (well, not very much), e.g. Bessel lowpass filters.

Lang describes an allpass EQ technique here: https://pdfs.semanticscholar.org/3534/e51b187f8a2f4a9cb462822d16ab8239c8d5.pdf. I also have a version of FDLS (Frequency Domain Least Squares) that does the same. Lang's method generally does a better job, but FDLS may be easier to understand and implement.

- Greg Berchin

IMHO, allpass based group delay EQ is worthless. As an example I have attached two group delay plots. One is of the sum of highpass and lowpass LR4 filters. The other is a 5th order crossover that I have been working on. I challenge anyone to develop an analog or IIR allpass based group delay EQ scheme for these that will result in a flat, or even relatively flat group delay. These are actually relatively easy examples because the GD peaking is quite minor.

The reason why you cannot EQ these group delay curves is that the group delay is less at higher frequencies than at lower frequencies. So the inverse group delay curve (e.g. the group delay EQ curve that is needed) must do the opposite: it must be low near DC and then increase and stay up at higher frequencies. Analog allpass or IIR digital formulations CANNOT DO THIS!

In general this shape of the group delay curve is the same for all crossover types, in general. There is just more or less peaking at the crossover point, which in this case is 1kHz for both examples and representative of e.g. a 2-way speaker.

The only solution can I see to the problem is to use FIR filtering. Then you can make the shape of the group delay EQ curve match what you need and the group delay can be equalized to be as flat as you want so that all frequencies will appear "in phase" (which is the same thing as saying that they have the same group delay).
 

Attachments

  • LR4 group delay.PNG
    LR4 group delay.PNG
    28.9 KB · Views: 226
  • 5th order group delay.PNG
    5th order group delay.PNG
    31.5 KB · Views: 226
Last edited:
IMHO, allpass based group delay EQ is worthless.

I wouldn't say it's worthless. It may be impractical.

I challenge anyone to develop an analog or IIR allpass based group delay EQ scheme for these that will result in a flat, or even relatively flat group delay.

I've attached a plot of the group delay necessary to flatten your LR4, 1kHz response, assuming 48 kHz sampling (blue trace), as well as the group delay achieved by the allpass EQ filter designed by FDLS (red trace). So it's possible. But in this case it requires a 70th-order IIR allpass filter, so I would call it impractical.
 

Attachments

  • ReallyBigAllpassFilter.png
    ReallyBigAllpassFilter.png
    36.5 KB · Views: 261
I wouldn't say it's worthless. It may be impractical.



I've attached a plot of the group delay necessary to flatten your LR4, 1kHz response, assuming 48 kHz sampling (blue trace), as well as the group delay achieved by the allpass EQ filter designed by FDLS (red trace). So it's possible. But in this case it requires a 70th-order IIR allpass filter, so I would call it impractical.

OK, I acquiesce to the terminology of impractical versus worthless. :)

Actually, I find it pretty impressive to see that being fit using allpass stages, even if it requires 70th order. Interesting. But like I said these are relatively mild examples. Perhaps even more peaking GD could also be done too, but we are already beyond reasonable with the allpass approach.

This can be flattened using a few thousand tap FIR filter. I recently wrote an FIR LADSPA plugin to explore exactly this sort of thing. I hope to be able to switch it in and out of the audio stream as test of audibility of group delay peaking, since there is a dearth of data on that subject. Otherwise to date I have not been user of FIR filtering, although that may change in the future.
 
OK, I acquiesce to the terminology of impractical versus worthless. :)

There are plenty of situations where impractical might just as well be worthless. This may be one of them.

Actually, I find it pretty impressive to see that being fit using allpass stages, even if it requires 70th order. Interesting. But like I said these are relatively mild examples. Perhaps even more peaking GD could also be done too, but we are already beyond reasonable with the allpass approach.

FDLS is very flexible. What matters most is the maximum group delay, since everything has to be adjusted relative to that.

This can be flattened using a few thousand tap FIR filter. I recently wrote an FIR LADSPA plugin to explore exactly this sort of thing. I hope to be able to switch it in and out of the audio stream as test of audibility of group delay peaking, since there is a dearth of data on that subject. Otherwise to date I have not been user of FIR filtering, although that may change in the future.

Have you considered matched-delay filtering? Easy to do in digital. AES E-Library >> Perfect Reconstruction Digital Crossover Exhibiting Optimum Time Domain Transient Response in All Bands; also available from me if you're not an AES member.
 
I have attached the image at your Google drive link. It would appear that your (horn) tweeter is crossed over around 3.5 kHz. If that is true, then you need to do some alignment of the acoustic centers FIRST before you worry about group delay EQ! You are way outta the ballpark as it stands now, meaning there is a large delay of the signal from the tweeter.

You can bring this into much closer alignment using digital delay applied to the lower frequency driver(s). There is a systematic way to do it, but it requires measurement tools and some software. But for a first approximation you can calculate the delay based on the physical offset between the diaphragms of the drivers. Then you apply delay to the drivers that are physically closer to the listening position. The amount of time of the delay should equal the acoustic center offset divided by the speed of sound. When you apply this delay, the signal from the drivers is moved "backwards". The goal is to line up all the acoustic centers.

You should do that before any attempt to do group delay EQ.

Units are important. Use length in meters. Speed of sound is ~345m/s. This gives you delay in seconds. To convert to milliseconds of delay, multiply by 1000.
 

Attachments

  • WTF.PNG
    WTF.PNG
    240.3 KB · Views: 92
Does anyone here know whether the 70th Order Group delay compensator Greg Berchin demonstrated here, could be implemented in practice in EqualizerApo?

I would recommend against it. As IIR filters go, that one is huge. Even implemented as biquads, you may run into numerical precision problems. And I haven't even done a stability check. What I presented was just a quick pass through FDLS to see if it could handle it.

On top of that, I'm not even sure that a linear phase LR4 is a good idea.

GB
 
Most of the phase wraps are caused by misalignment between the drivers. Best way is to physically move the drivers so that they are all the same distance from the listener. Second best is to use an active digital crossover and time delay each band as necessary. Trying to EQ the phase with allpass filters is probably impractical.

Crossover is at 800Hz. Is it causing the wrap up high?
 
Crossover is at 800Hz. Is it causing the wrap up high?

Honestly, I think you should double check that. The phase plot strongly suggests that your crossover is around 3.5k or so. Why else would there be a strong change in delay for the system (that is what is causing the rapid increase in rate of change of phase, causing all of the phase wrapping).

How are you implementing your crossover (e.g. passive, active, etc)?

Can you disconnect the woofer and just measure the output from the tweeter?

Does the tweeter use a dual or coaxial diaphragm?
 
Honestly, I think you should double check that. The phase plot strongly suggests that your crossover is around 3.5k or so. Why else would there be a strong change in delay for the system (that is what is causing the rapid increase in rate of change of phase, causing all of the phase wrapping).

How are you implementing your crossover (e.g. passive, active, etc)?

Can you disconnect the woofer and just measure the output from the tweeter?

Does the tweeter use a dual or coaxial diaphragm?

Single diaphragm tweeter, active speaker.

I will have to run the sweep again I think!