Why not IIR filters + a global phase linearization by FIR

Hi Gregory. Been a long time.
Hello. Forgive me; no disrespect intended: do I know you?

I would agree that an F(I)R filter could be constructed that had non linear phase such that the delay increased with frequency such that the sum of the LP phase and the band pass phase would be that of a constant delay. But just adding stages of typical band pass filters won't linearize nonlinear phase of an LP filter.
I am speaking of formal IIR digital allpass filters, of the form [b0 + b1z^(-1) + ... + bnz^(-n)] / [bn + b(n-1)z^(-1) + ... + b0z^(-n)], i.e., the numerator and denominator coefficients are identical but in reverse order. This can be thought of as a giant allpass filter, or as the convolution of many 2nd- and possibly 1st-order allpass filters. By varying the cutoff frequencies and quality factors of the individual constituents, the resulting allpass phase shift can (usually, but not always) equalize the phase of the original lowpass filter to approximate constant delay up to some maximum frequency.

I just happen to have created a method by which this can be accomplished: https://www.dsprelated.com/showthread/comp.dsp/375937-1.php Matlab also has the iirgrpdelay() function, which works quite well. And Markus Lang has a couple that may be the best-performing of the bunch: https://www.ece.rice.edu/dsp/software/allpass.shtml The procedure would be to decide upon the desired overall delay after equalization, translate that into phase shift vs. frequency, subtract the observed phase shift in the existing filter, and feed the remaining excess phase into the algorithm to attempt to create an allpass filter that achieves it.

An FIR filter can be constructed with phase as pictured below, in theory, which when in series with the LR2 pictured above would result yield a zero phase (zero delay) response. Such a filter has less "negative delay" as the frequency increases. But this filter has negative GD (delay) and as you point out would be non causal.
Yes, it is possible for a filter to exhibit negative group delay locally, but overall the group delay (and phase delay) must be positive else the filter is noncausal. To accomplish this by explicitly adding delay to the impulse response is common practice.
 
Hi John

You need to use 2nd order allpass filters that have a faster turning/dropping phase response around their pole frequency. This means that they have a peaking group delay response. You can see in the graph that I posted above how it works. It does always work over a limited bandwidth only. For large bandwidths a large number of allpass filters is needed. Above the useful range gropup-delay drops like a stone and the step response does also show some out of band pre-ringing.
This type of EQ does nothing else than generating additional group-delay where the unequalised crossover has less of it originally.

Regards

Charles
Thanks Charles. I get it. So a 2nd order all pass with Q greater than 0.5 and F0 and Q carefully chosen to locally increase the rate of phase rotation. Hadn't though of that. But a large number of all pass filters will also increase the total delay. On the other hand you could obtain the impulse response of the cascaded all pass filters and emulate them with a single FIR filter. Being that the impulse would be causal, there would be no need to introduce additional delay for processing I think..

😉
 
Example for phase linearisation using only IIR filters:

1674142539831.png
 
  • Like
Reactions: john k...
Thanks Charles. I get it. So a 2nd order all pass with Q greater than 0.5 and F0 and Q carefully chosen to locally increase the rate of phase rotation. Hadn't though of that. But a large number of all pass filters will also increase the total delay. On the other hand you could obtain the impulse response of the cascaded all pass filters and emulate them with a single FIR filter. Being that the impulse would be causal, there would be no need to introduce additional delay for processing I think..

😉
Timo Beckman posts a blog with a ton of experiments and techniques comparisons, all measurement based.
The lucky man has more prosound measurement tools, processors, and speakers to test, than anyone I've stumbled across.

Here's a post on cascading 2nd order all-pass to flatten phase on a HF driver.
Uses 9 flipping all-pass filters just to do that. Not the world's most practical technique lol.
https://timobeckmangeluid.wordpress.com/2021/03/15/cascading-2nd-order-all-pass-filters/

Lot's of great posts by Timo, including one that emulates the cascaded all-passes with FIR.
Unfortunately, all the videos lack any voice explanation.
 
The filter does not only have to be in one part, you can convolve multiple corrections together. You could create an analytically derived phase correction just for the known crossover topology and use that in conjunction with an overall filter based on a measurement.

Agreed!

But why go to the trouble of convolving multiple corrections together, when you can more easily (and likely more accurately) get it right from the start, and not even need to such efforts?
By get it right from the start, I mean do the individual min-phase driver work necessary as quasi-anechoic as possible. And then add complementary linear-phase xovers.
Is there anything more straightforward, and easier than that? Or even anything with a higher likelihood of superior results?
(assuming multichannel active with FIR available for all channels)
 
The IIR method in post #443 may also be extended to correct higher order filters rather easily. In the following picture, the phase is essentially linear to 600Hz, where the magnitude response is down to -100dB. The final GD is comparable to the DC GD of the original filter.

Please note that the same 2nd order APF has been casually repeated 4 times without using any curve fitting / optimisation techniques that could give much better results.

So, I guess that means IIR filters are not all that useless after all.

1674149604201.png
 
The IIR method in post #443 may also be extended to correct higher order filters rather easily. In the following picture, the phase is essentially linear to 600Hz, where the magnitude response is down to -100dB. The final GD is comparable to the DC GD of the original filter.

Please note that the same 2nd order APF has been casually repeated 4 times without using any curve fitting / optimisation techniques that could give much better results.

So, I guess that means IIR filters are not all that useless after all.

View attachment 1132133

What does 4xAPF 480 Hz, Q=1.7 mean. More specifically, 4xAPF ?
 
But why go to the trouble of convolving multiple corrections together, when you can more easily (and likely more accurately) get it right from the start, and not even need to such efforts?
When speaking of the crossover only there is no reason if a linear phase response is desired and a linear phase crossover filter or equivalent is available. For you it is but not everyone has the hardware or software to do it per driver. It can make sense to split corrections up into separate parts and deal with problems individually.

As far as I am concerned there is no way to get it right from the start at low frequencies in a room. But you could linearize the crossover induced group delay of an existing speaker with good anechoic response, analytically in one correction and then apply a separate correction for the in room problems. These can remain separate or be convolved together into one single filter.
Or even anything with a higher likelihood of superior results?
The answer is yes and was described in the part of the post you did not respond to 🙂
 
What does 4xAPF 480 Hz, Q=1.7 mean. More specifically, 4xAPF ?
It simply means a second order allpass filter (two poles, two zeroes) with a Q of 1.7, repeated four times one after the other, to obtain four times the phase correction (picture) required for the 8th order Bessel filter. The phase at 480Hz is 4*pi radians or 720 degrees.

Please note that this is just a simple, manual non-iterative method and a better correction could be achieved using curve-fitting methods such as the one given by @gberchin.

1674185206795.png
 
It simply means a second order allpass filter (two poles, two zeroes) with a Q of 1.7, repeated four times one after the other, to obtain four times the phase correction (picture) required for the 8th order Bessel filter. The phase at 480Hz is 4*pi radians or 720 degrees.
That's what I thought but when I simulate that I wasn't getting your result. Found an error in my sim, Looks better now. Top, 8th order Bessel only, bottom, LP + 4xAPF.

F4.jpg


But, if I can throw a wrench into all this, I'm not quite sure what benefit extending the linear phase region into the stop band has from an acoustic point of view. Suppose I use this filter on a woofer that has a band pass response, 12db, 25Hz HP, 18db, 500 Hz LP. The acoustic out put would have phase and GD like this, where the top figure is the Bessel LP + woofer and the lower Bessel LP + 4xAPF + woofer. The plot to the side show a comparison of the GD for both on a log scale. Other than the increase in GD there isn't much difference in below 100 Hz because the GD is dominated by the woofer low frequency cut off. With FIR filtering it's possible to achieve linear phase and constant GD for the system, including the woofer with just one filter. This goes back to the original premise of this thread, IIR EQ and FIR phase linearization of the system, but if you were to use FIR phase linearization, it would be no mor effort to include the EQ in the FIR filter and drop the IIR. I've done that and it works very nicely.

F5.jpg
 
But, if I can throw a wrench into all this....Other than the increase in GD there isn't much difference in below 100 Hz because the GD is dominated by the woofer low frequency cut off.
Yes, there may be no benefit at such frequencies, however that would equally apply to all kinds of filters. The reason why I demonstrated various kinds of filters in this thread was that linear phase was brought up as a major advantage of FIR filters, often without references to filter delay that needs to be tolerated to achieve it.

With FIR filtering it's possible to achieve linear phase and constant GD for the system, including the woofer with just one filter.
Yes, one could do that if the accompanying delay is OK to them, as no filter can truly roll back the phase / delay of the system, but only linearise / equalise it. Nevertheless, accuracy and delay directly relate to the length of the filter, and therefore achieving one of these simply contradicts the other, and it may not be possible to have short filters for low frequency applications.
 
When speaking of the crossover only there is no reason if a linear phase response is desired and a linear phase crossover filter or equivalent is available. For you it is but not everyone has the hardware or software to do it per driver. It can make sense to split corrections up into separate parts and deal with problems individually.
Maybe you missed my caveat....(assuming multichannel active with FIR available for all channels).
I know that's not available to perhaps most.....but if someone is already using multi-channel amplification, the FIR part is easily in reach with a computer.
As far as I am concerned there is no way to get it right from the start at low frequencies in a room. But you could linearize the crossover induced group delay of an existing speaker with good anechoic response, analytically in one correction and then apply a separate correction for the in room problems. These can remain separate or be convolved together into one single filter.

The answer is yes and was described in the part of the post you did not respond to 🙂

I didn't respond on purpose...didn't want to Segway into room correction.

Frankly, I have a hard time caring about the idea of optimizing to a listening location.
Every time i start in on it, I start saying to myself......isn't this is a huge backwards step that I pursued for nearly 40 years, trying to make stereo as gorgeous as possible in a variety of rooms with variety of speakers?
In that pursuit, I even built one large room from the ground up, specifically designed for sound, to be acoustically excellent.
Played with more sub optimizations in that room than i care to remember. Hells bells, tried all sorts of tsub placements and processing.... I even flew a 220lb subwoofer from different locations on the 12 ft high ceiling....as part of a multi-sub smoothing. Had 5 subs to play with.
Sounded great, worked great, pretty dang even bass other than deep corners, etc.

But then i took subs and speakers outdoors.....well, all i can say is, screw rooms if you want to know what good bass is about. (not to mention overall clarity high to low.)
There's also the issue, i seldom sit down to listen. I'm alwasys doing something, like dancing with my honey ! And I really like to listen from other rooms...a great test of tuning quality imo. The LCR thing i've been working on begs for a focused listening spot, and does sounds super there...I just hate sitting on my butt by myself for very long.

OK, this is all just me and a big so what.....
but pls understand, i think optimizing to a listening position in a room is all well and good, it's just hard for me to get excited about....
 
The plot to the side show a comparison of the GD for both on a log scale. Other than the increase in GD there isn't much difference in below 100 Hz because the GD is dominated by the woofer low frequency cut off.
This method is generally used for say a compression driver to LF in a two way box and was used before digital was available, it can be done with active RC networks.
 
Yes, there may be no benefit at such frequencies, however that would equally apply to all kinds of filters. The reason why I demonstrated various kinds of filters in this thread was that linear phase was brought up as a major advantage of FIR filters, often without references to filter delay that needs to be tolerated to achieve it.


Yes, one could do that if the accompanying delay is OK to them, as no filter can truly roll back the phase / delay of the system, but only linearise / equalise it. Nevertheless, accuracy and delay directly relate to the length of the filter, and therefore achieving one of these simply contradicts the other, and it may not be possible to have short filters for low frequency applications.
Re sample length, if you do it driver by driver in a multiway system sample length isn't as much as a problem as you can use different sampling rates. The sample rate and length can be tailored for the desired band width. You may want 5 or 10 Hz resolution at low frequency for a woofer that will have a 100 Hz LP cut off but you don't need 5 Hz resolution for a tweeter with 2k Hz HP cut off.

As for delay, how significant is it? In my experience it's not the causality issue but processing time for FIRs, even using FFT and frequency domain convolution. Of course, I was doing thins an a W7 PC with relatively slow processor.
 
It is very significant for live performances. Musicians get tripped-up when there is more than a few tens of milliseconds in the sound reinforcement chain.
I'll give you that but for home audio/video, not so much. Frankly, as far a linear phase systems go, regardless of how they are derived, I've been woking on them for years. I always thought they made a difference. It wasn't until I was involved with developing software to build linear phase system using FIR that I came to the realization that it makes little difference. With this came the ability to take an ordinary speaker and make it linear phase w/o effecting polar response. Some will claim they hear a difference. Some say the digital processing masked the difference. Some say it matters in the bottom end. I have a hard time with that, for home audio, where the bottom is dominated buy modal response of the room.
 
  • Like
Reactions: ernperkins
I think that we might be losing sight of the real issue here (or at least one of them). Linear-phase FIR filters are generally practical at higher frequencies, because the number of coefficients in the filter is relatively small. At very low frequencies, though, one might have to choose between an 8th-order IIR filter, with perhaps 20 multiply-add operations, and a 2000+ order FIR filter that uses 10x the number of operations. If one has gigaflops of processing power, then a low-frequency FIR filter may not be a problem. But if one has an inexpensive dedicated DSP with small memory and low clock frequency, then IIR may be the only practical answer. And yes, inexpensive dedicated DSPs still exist and are still used.