group delay equalization

Status
This old topic is closed. If you want to reopen this topic, contact a moderator using the "Report Post" button.
I am interested in designing a group delay equalizer. I have found some journal articles on the subject from authors Quelhas and Okoniewski (for example, see here) that seem to outline a starting point for the placement of the poles of multiple all-pass sections. An optimization algorithm is sometimes applied to minimize the delay ripple. I'd like to learn more about this process before I jump in and try it myself.

If the pole locations are just an estimate, can this be made more crudely? Since optimization is being used anyway, how "close" does the starting point need to be to the solution?

The motivation for doing this is that I would like to start using some higher order elliptic filter based crossovers that I have developed. One consequence of the high order is high Q sections that result in group delay peaking. This can be ameliorated by group delay equalization, and this has spurred me on to look in to this topic in more detail.

If it works out for me I might create an ACD extension for doing GD EQ. I would probably set up the problem in Excel and then use the non-linear optimization that is part of the built in Solver add-in to complete the design.
 
Last edited:
If you aren't averse to dsp EQ, try the minidsp openDRC (or miniSharc) along with the free Rephase program. Given a measured dB+phase response of your speaker, group delay eq is almost trivially easy to do then. No equations or math, just move sliders to adjust phase at each frequency range. Works great.
 
If you aren't averse to dsp EQ, try the minidsp openDRC (or miniSharc) along with the free Rephase program. Given a measured dB+phase response of your speaker, group delay eq is almost trivially easy to do then. No equations or math, just move sliders to adjust phase at each frequency range. Works great.

No thanks, I'll pass on that. I'm not at all a fan of Dirac and FIR. I'm planning to implement the delay EQ as multiple 2nd order IIR all-pass filters in (software) DSP.

I stumbled on this MathWorks/MATLAB routine that let's the user specify some arbritrary group delay target function and then fits N delay stages to it. Manpage for the routine is here:
Arbitrary group delay filter specification object - MATLAB fdesign.arbgrpdelay
So it seems doable. This is the route that I want to try first. I will be trying to optimize the Q and corner frequency of each all-pass stage to minimize the group delay difference across the driver's passband, or something like that.

I'd just like to get the big picture regarding this approach, see what the pitfalls may be, etc. If anyone has experience with the fdesign.arbgrpdelay routine I would love to hear about it.
 
Last edited:
Linear Phase equalization

No one has anything to add about IIR (all pass) delay equalization?

I guess this is not very nomenclature, so perhaps I should state the problem in more familiar terms:
I am trying to achieve linear phase by adding all-pass filters to equalize (make flat) the system group delay.

Flat group delay and linear phase are the same thing.
 
Charlie,
I think you'll have a big job to get elliptical filtered stuff to linear phase via IIR. Not completely impossible, but it won't be exactly easy. Unless your speakers are minimum phase, it might not even be doable. Why do you rule out FIR, btw? (I didn't mean Dirac, RePhase is free and manually controlled not automated).
 
Charlie,
I think you'll have a big job to get elliptical filtered stuff to linear phase via IIR. Not completely impossible, but it won't be exactly easy. Unless your speakers are minimum phase, it might not even be doable. Why do you rule out FIR, btw? (I didn't mean Dirac, RePhase is free and manually controlled not automated).

There are plenty of examples of using all-pass stages to equalize elliptical filters (at least low pass versions). I don't think there is any reason to use FIR, plus the DSP crossover systems that I am currently using only implement IIR filters. The problem doesn't seem to be too difficult, and I have all the tools to do it.

You are correct - I will need to implement delay EQ on the system delay that includes the phase response of each driver. I can know this very easily via my modeling program, ACD, or a system measurement.

Anyway, I will investigate further and then post about it.
 
I applied a couple of all-pass filters to the low-pass stage of the elliptic-derived crossover filters that I am currently modeling. I could pretty easily get the group delay below the crossover point to flatten, with ripple, using only a couple of filters.

On the other hand, doing the same thing to the highpass side of the crossover seems very difficult to impossible. This is because of the shape of the delay that an all-pass filter can create. It's sort of like the amplitude response of a lowpass filter - there is some constant value at DC and then near the "corner frequency" can peak but then falls away to zero. This shape works well when you want to equalize the lowpass section because the delay of the crossover system is typically starting low and then peaking at the crossover point before dropping back down to near zero in the highpass side of the filter.

Unless I can find a way to do both high and low pass with IIR all-pass and digital delay I may need to consider embracing FIR for this. I have no idea if my hardware is fast enough for FIR processing, however, I might be able to used a mixed approach with IIR for the lower frequencies and FIR for the higher frequencies.

I seem to recall the FIR calculations for low frequencies requires more taps than for higher frequencies. Is that correct?

Or you need more taps for increased frequency resolution, and so at low frequencies or for steep changes in the frequency of phase response, you need a lot of taps. Is that statement a little more accurate???
 
Last edited:
So, now I am looking at rePhase's graphical "phase equalizer" (online, I haven't actually downloaded it yet). I should be able to use rePhase to "equalize" the group delay (not the frequency magnitude), reducing the peak and bringing up the region above 1kHz. Since this is rather smooth I might be able to get away with a relatively low number of taps. I already wrote some code to implement a circular buffer for IIR delay and I might be able to adapt that for FIR work or I could just break down and use some existing code, etc.

As an example, the group delay of my 7th order elliptic-filter-based crossover, and the group delay of a 7th order Butterworth crossover, is shown in the attachments.
 

Attachments

  • ellip7-GD.PNG
    ellip7-GD.PNG
    15.5 KB · Views: 337
  • BUT-7-GD.PNG
    BUT-7-GD.PNG
    16.7 KB · Views: 344
Or you need more taps for increased frequency resolution, and so at low frequencies or for steep changes in the frequency of phase response, you need a lot of taps. Is that statement a little more accurate???

I just think of it as low frequencies having more samples per cycle and if you have to keep HF behaving, you'd need to have taps placed all the way through. That might not be accurate, either, though. I'm certainly no expert on FIR, more or less just a user (and a big fan - there's nothing like having omnipotence over waveform shaping!).
 
I've been looking into FIR filters in a little more detail. Although you can just flatten magnitude and phase using lots of taps, I'd like to look at a "lighter" use of FIR filtering for phase linearization of the higher frequencies only. I will explain with an example below.

The first attachment shows a model of a loudspeaker frequency response. This has a 4th order HP function at 30Hz to simulate a vented box, and a steep crossover at 1kHz. The resulting group delay for the system is shown in the second attachment. The GD is characterized by a rise in the low bass region, a constant but elevated region in the woofer passband, a peak at the 1kHz crossover frequency, and then a return to near zero in the tweeter passband. This general shape is typical of a loudspeaker system.

What I would like to do is to "remove" the peak at the crossover point and bring up the group delay in the tweeter's passband to the same level as the woofer. I will not attempt to modify the GD below 200Hz. We need a filter that can create the group delay EQ curve as shown by the line in the third attachment. This "removes" delay from the system at the peak around the crossover point and "adds" delay above. The result would be "flat group delay" for the loudspeaker above about 200Hz. This is the same things as linear phase in that same frequency region. At the same time we do not want to change the magnitude of the system, which has been made sufficiently flat using IIR filters.

So, how to do this? You cannot generate this phase/group-delay correction using any number of IIR filters because the group delay must be increased at higher frequencies. Instead an FIR filter is needed.

The process of generating FIR filter coefficients for constant-amplitude phase modulation seems a little different from that of FIR magnitude filtering. If I understand the process correctly, one can first calculate the phase response that corresponds to the EQ filter group delay response that we want. This can be done by integrating upwards with a phase of 0 degrees below where the GD leaves zero, and using the definition of group delay as -d(phi)/d(omega). The amplitude response for all frequencies of our EQ filter is simple set to 1 (0dB). Next we generate the impulse response of this system. The system must be causal, so in this case we would need to shift the impulse response "later" in time - this is the same as moving the group delay of the filter "up" until there are no negative values and we could have done this to the desired filter group delay earlier. We then window/truncate the impulse response where it has sufficiently died down. This gives us our FIR filter coefficients. I think. Like I said I am still learning about the process of generating FIR filters for phase-only manipulation.

What seems attractive about this is that the filter's impulse response should be short. This is because there is nothing happening at low frequencies, and high frequency components die out faster. This means that the length of the FIR filter will not be long, perhaps a couple thousand taps at the most, and a few hundred at the least. This would make the FIR filtering calculations "light", keeping latency and computational requirements low. This is important to me.

So, this looks possible, and I need to do some modeling and simulation of everything to test out my theory. If someone with more FIR knowledge can chime in to verify or refute what I have outlined above I would appreciate it.
 

Attachments

  • sys-FR.PNG
    sys-FR.PNG
    46.1 KB · Views: 208
  • sys-GD.PNG
    sys-GD.PNG
    30.9 KB · Views: 216
  • EQ_FILTER_GD.PNG
    EQ_FILTER_GD.PNG
    28.3 KB · Views: 208
Im not the guy with lots of experience you asked for, but unless you're into it for the intellectual challenge, imo you're overthinking it. All I did was first iir the response (the OpenDRC/miniSPARC does both fir and iir) flat and then get an FRD file of the complex FR of the speaker. Remove overall delay so that phase slope was nearest zero overall, but always below zero. Then take the file to RePhase, pull the phase response flat to zero, generate the taps file, export, then import into OpenDRC. Literally took about an hour. (Though the speaker was already close to linearish in phase, except in the bass because of the reflex cabinet and high slope crossover on the subs).

For what its worth, the audible change I'm most confident of was in the bass. Might be expectation bias (that's where phase is said to be audible) or might be because that was where most of the phase changes were done -above 300Hz or so everything was already within about 30 degrees before eqing). Also some response magnitudes had been changed, too. No DBT, just the impression of more solid kick like from an object instead of from resonators.
 
Literally took about an hour.
I should qualify that a bit. EQing was about an hour, but figuring how to get rid of a very low level, but annoying, whine from the OpenDRC took a few days (if anyone is having that issue, the fix is to put about 1mH in line on the red power wire between the dsp board and the dac board. Use a low dcr iron cored crossover type inductor)
 
This plot should show my approach a little more clearly. The un-equalized system group delay is shown in dark blue. I can equalize the group delay to the flat (linear phase above 150Hz) dashed blue line if I add group delay equal to the tan line.

To do this I will calculate the phase that corresponds to the tan line using the definition of group delay and integrating up from zero. I will then set amplitude =1 for all frequencies. I now have (amplitude, phase) pairs for all frequencies. Using the iDFT I can generate the impulse response, which may or may not be windowed. This gives the FIR filter coefficients.

I can then calculate the FFT filter frequency and phase response while I vary the number of taps to see how few I can get away with before ringing sets in, etc.
 

Attachments

  • GD-ideas.PNG
    GD-ideas.PNG
    36.5 KB · Views: 179
Last edited:
Flattening gd >150hz will do any good to the sound?
Yes, it helps with transients, etc.
What about the gd <150?
The brain is not very sensitive (at all) to large group delay there. It is more and more difficult to "fix" at lower frequencies, and this is also where it is getting large, so I do not plan on flattening this part of the group delay response at this time.
 
Imho, flattening a peaking gd won't do any good because will create preresponse issues: no free lunch here so better forgetting about those monstruous high order elliptic minphase stuff.

Don't agree with gd not being a problem in itself. Correcting the gd of the acoustic high pass filter of a loudspeaker(almost flat to DC) the Michael Gerzon way sounds actually very good to my ears, and works better with a closed box than with a BR. The only issue is latency, but for home hifi use and even for video with players like JRIVER in fact it is not.
 
Imho, flattening a peaking gd won't do any good because will create preresponse issues:
The filter will just add more or less latency (if you like that term). I don't anticipate any pre-ringing, but I plan to check for that. I don't exactly know what to expect when I vary the number of coefficients.

no free lunch here so better forgetting about those monstruous high order elliptic minphase stuff.
No I plan to use them whether I correct the group delay, or not. I have already done so in a previous loudspeaker project.

Don't agree with gd not being a problem in itself. Correcting the gd of the acoustic high pass filter of a loudspeaker(almost flat to DC) the Michael Gerzon way sounds actually very good to my ears, and works better with a closed box than with a BR. The only issue is latency, but for home hifi use and even for video with players like JRIVER in fact it is not.
In that case I invite you to stick to your Michael Gerzon method.
 
Status
This old topic is closed. If you want to reopen this topic, contact a moderator using the "Report Post" button.