rePhase, a loudspeaker phase linearization, EQ and FIR filtering tool

Too late to edit my previous post. I was going to add:

I still haven't got my head around phase vs. delay when it comes to 'correction'. If there's a phase deviation of >360 degrees (which constitutes a delay..?) I'm assuming that it's not possible to correct it by phase only, and maintain time domain coherency of a transient - which I had thought was the main aim of the exercise, apart from matching drivers' phase in the crossover region.

Do real world drivers exhibit a phase characteristic and also a delay characteristic i.e. a pulse can be set in motion that doesn't emerge at the diaphragm until a fixed propagation delay has passed?

Is there an upper frequency limit to phase correction?

Think of unwrapped phase delay. Smooth slope without excessive number of inflection points and lumpiness in between is first objective. Removing main slope is second.

Phase becomes less and less important with increasing frequency. Sure, flattening it out to Nyquist frequency is neat, but just considering content in natural sources; How much evolutionary survival value is there in phase information above 2kHz? Localizing is intensity driven up high. Getting tweeter to integrate with range below as single source is primary effort.

Measurement to diaphragm surface doesn't help. JohnK approach of referencing to baffle is direct measurement approach to excess phase. Time of flight differences is real target.

If measurement system is stable, back to back measurements yield identical timing of IR location in recovered waveform. This is easy to test. When this is case, switching from tweeter to woofer measurement preserves exact time of flight difference between the two drivers.

Some measurement systems/software behave well, some don't.

Use of multiple sweeps with a set number of sample in between allows tweeter to be measured, muted, then woofer unmuted and measured in single measurement. Raw sweeps are split based on sweep length and inserted sample length. Results show perfect relative orientation in time.

Waveforms are adjusted to same amplitude at crossover frequency. Timing is tweaked so phases match at crossover frequency. If phase slopes match extended overlap occurs, otherwise phase slopes intersect. Differing slopes may be differences in drivers, and sometimes indicates a driver needs leads reversed (and more tweaking).

Measurements need to be done at distance where baffle effects become inconsequential.

Broadband minimum phase/causal impulse systems must have group delay, and thus phase response with slope. All frequencies start at zero amplitude at t=0.

Although virtually all natural sound sources have causal behavior, and speakers have response, information transmission is continuous system, and is best treated as such. Bandwidth is bandwidth, not IIR bandwidth or FIR bandwidth.

Filters viewed as waveforms may lead many to hear what they are looking at. Much as many great speakers sound great until room measurement is taken, and suddenly that floor/ceiling mode low frequency behavior at listening position sounds just terrible. :D

High order crossover filters sound bad regardless of IIR/FIR nature due to underlying design choices. Causal filter's ringing is better masked to human perception by precedence effect, but high order filters have loads of extended ringing, that when misaligned with conjugate leads to descriptions such as "sounds phasey".

Addition of 100u capacitor for tweeter measurement is adding several degrees of phase change. Limiting power, and or sweep range is best.

Regards,

Andrew
 
The thing about the integral approach is that it tells you something very important. It tells you that while the phase at any frequency depends on the amplitude from DC to infinity, it also tells you that the contribution to the phase at a given frequency weights the amplitudes nearest that frequency most heavily. And it also tells you what the phase is once the slope is established in the roll off region. For example, if the response has a constant slope of Ndb/octave the slope well be 15 x N degrees. So you know just by looking at the response of a band pass filter, for example, what the phase asymptotes will be. For example, a band pass with a 4th order high pass and a 3rd order low pass characteristic will have 360 degrees phase at DC (24 x 15) and -270 degrees at infinity (-18 x 15). (These are unwrapped phase).

thanks for the explanations.
it's useful to understand limits of discrete filtering/EQ.

may we have not to considering the high frequency phase resulting.
it's hard to hear a difference between linear phase and minimum phase in the lows,so in the highs...
otherwise,this is a good exercise,it 's free to linearize,using FIR EQ/Xover.
even if there's no audible improvement with low group delay.
 
Think of unwrapped phase delay. Smooth slope without excessive number of inflection points and lumpiness in between is first objective. Removing main slope is second.

Phase becomes less and less important with increasing frequency. Sure, flattening it out to Nyquist frequency is neat, but just considering content in natural sources; How much evolutionary survival value is there in phase information above 2kHz? Localizing is intensity driven up high. Getting tweeter to integrate with range below as single source is primary effort.

Measurement to diaphragm surface doesn't help. JohnK approach of referencing to baffle is direct measurement approach to excess phase. Time of flight differences is real target.

If measurement system is stable, back to back measurements yield identical timing of IR location in recovered waveform. This is easy to test. When this is case, switching from tweeter to woofer measurement preserves exact time of flight difference between the two drivers.

Some measurement systems/software behave well, some don't.

Use of multiple sweeps with a set number of sample in between allows tweeter to be measured, muted, then woofer unmuted and measured in single measurement. Raw sweeps are split based on sweep length and inserted sample length. Results show perfect relative orientation in time.

Waveforms are adjusted to same amplitude at crossover frequency. Timing is tweaked so phases match at crossover frequency. If phase slopes match extended overlap occurs, otherwise phase slopes intersect. Differing slopes may be differences in drivers, and sometimes indicates a driver needs leads reversed (and more tweaking).

Measurements need to be done at distance where baffle effects become inconsequential.

Broadband minimum phase/causal impulse systems must have group delay, and thus phase response with slope. All frequencies start at zero amplitude at t=0.

Although virtually all natural sound sources have causal behavior, and speakers have response, information transmission is continuous system, and is best treated as such. Bandwidth is bandwidth, not IIR bandwidth or FIR bandwidth.

Filters viewed as waveforms may lead many to hear what they are looking at. Much as many great speakers sound great until room measurement is taken, and suddenly that floor/ceiling mode low frequency behavior at listening position sounds just terrible. :D

High order crossover filters sound bad regardless of IIR/FIR nature due to underlying design choices. Causal filter's ringing is better masked to human perception by precedence effect, but high order filters have loads of extended ringing, that when misaligned with conjugate leads to descriptions such as "sounds phasey".

Addition of 100u capacitor for tweeter measurement is adding several degrees of phase change. Limiting power, and or sweep range is best.

All great stuff, thanks. I think I understand the unwrapped phase thing, now. I was worried that each FFT coefficient can only be phase-shifted by +/- 180 degrees, so how could I correct for >360 degrees of shift, but of course it's the cumulative effect of the multiple 'wraps' that produces the delay i.e. the FFT of a delayed impulse with its multiple phase rotations can simply be reversed to give the original delayed impulse again. It's not ambiguous at all.

When you say

Measurements need to be done at distance where baffle effects become inconsequential.

does that mean very close, or far?

If using REW to make impulse response measurements, should I be using its minimum phase export routinely, rather than attempting to do anything clever myself?
 
two more feature requests

The second optimization is iterative and takes place afterward: it is just trying to modify the target amplitude curve so that the result gets closer to the initial target curve.
Could the phase error also be taken into account? What currently happens when trying to synthesize constrained length filters with parametric or graphic phase EQ is the passband phase response tends to gets stuck around 45 degrees from the target curve. My experience is the threshold of phase audibility is around 10 degrees so, to be usuable, the filters should ideally within 5 degrees of target. Since the length is constrained by hardware adding more taps to improve the phase accuracy of the initial solution isn't an option---performance is governed by how much phase accuracy can the optimizer can wring out of the available number of taps.

Also, it'd be handy if the range of the phase axis in the graph could be changed like that of the magnitude axis. If you're trying to see if a phase error is less than five degrees having the axis cover 360 degrees is too much.

How do you apply that Remez exchange algorithm?
Not quite sure what you're asking here; Remez exchange is well documented on the web and in pretty much any intro DSP text so I assume you're familiar with its equiripple innards and lack of phase awareness as usually defined---it's usually used with linear phase synthesis, after all. I'd also argue the core operations of Remez, conjugate gradient, and other iterative solver methods are not fundamentally different that what's already implemented in rePhase, though different flavours of the math offer different convergence behaviours. My experience leads me to suspect a change of algorithm would improve rePhase's current magnitude performance.

A while back I looked into phase aware optimization a bit. As so much of FIR synthesis is linear phase there's not much out there. I'd coded conjugate gradient in complex math around a decade ago and had pretty good results with both magnitude and phase convergence for the problems I was solving with it. So I was thinking of starting by giving it a try for filter synthesis.
 
Administrator
Joined 2004
Paid Member
Any measurement can be corrected (either manualy using rephase, or automatically using DRC-FIR or UE for example), and after correction you should get a "perfect" impulse response
I've done this by hand in HOLMImpulse using smoothing and a target and also had it done in PORC. The results were similar, tho I can't say that either sounded any better than the non-corrected response, just different. (for my system)

Some measurement systems/software behave well, some don't.
I've had very good results with HOLMIpulse. Time can be locked and seems to stay that way with few problems. I've done a number of tests and found it to be stable as long as the computer is. I have one laptop that is not because of interrupts.
 
1" dome tweeter has potential for omnidirectional behavior to several kHz, so faceplate edges and edges of flat baffle "see" tweeter in crossover region, and baffle edge becomes delayed source. Measurements should be taken at a distance on the order of 6x the effective radiation aperture to get baffle step, or measure real close to swamp out reflections, and add totally synthetic baffle step correction.

This is tempered against ratio of direct to reflected energy, and ability to gate out, or potentially use. Correcting subs below 2nd mode frequencies of room allows great latitude in microphone placement, but reflections much above 200Hz (In my experience) introduce artifacts that range from hard to pick out, up to sounds not unlike whistling into a fan blade when using direct inversion of IR as correction.

Many using DRC find this, and by beating out artifacts are also left with little effective correction.

For Pluto type speaker good baseline measurement is possible at 9" for direct inversion to create correction filters for both drivers. These may be driven with crossover and single correction applied; or may be individually measured from same point, responses inverted, and desired crossovers applied to correction filters for result.


Synthesis of correction is only as good as synthesis method is in recreating real response.
 
I found afterward that this iterative optimization was already used by Rainer Thaden in the Four Audio HD2 processor:
http://www.studitech.ru/resque/manuals/fouraudio/HD2-AES32_rev-5.pdf

How do you apply that Remez exchange algorithm?
I haven't found strict Remez exchange good for anything but very high slope 'classical' functions. It's no good for the type of arbitrary response corrections required in speakers & mikes.

My bastardised method has much in common with Thaden & your method except I use the 'phase' info. I first got the idea from either Numerical Recipes or Oppenheim & Schafer.

Don't have access to books. I've been a beach bum for well over a decade and only emerged from the bush in 2005 when the magic internet reached Cooktown, Oz.
_____________

Gotta declare my prejudices if they are not already clear from the 2 AES papers.

IMHO, the correct way to do digital EQ is to equalise the Minimum Phase part using IIRs as in my 2008 paper. Then if you want the phase correcting (I don't in most cases), pick and choose the exact parts to EQ and use a FIR.

This is the approach used by Greenfield - Efficient Filter Design for Loudspeaker Equalization He's also got some papers on the evils of using Linear Phase xovers.

What's exciting for me is this millenium, we now have the computing power to do speaker+room. But the optimum strategy for this is yet to be dreamt up. This mythical beast would take my "surround sound system is a speaker" to the next level.

As in ALL EQ, what you DON'T EQ is as .. if not more important as what you do EQ.
 
Last edited:
Administrator
Joined 2004
Paid Member
As it is now, to see the effect of a correction you can do the convolution inside HOLMImpulse, using the "C=A*B" manipulation : you put your measurement in one slot, the correction impulse in another, and you generate the result in the C slot.
When I do this, I get a perfectly flat phase plot, but no amplitude! Never seen a HOLM plot with no amplitude trace. What am I doing wrong? :scratch:
 
I guess I'm missing something becuase I don't understand the need to iterate.

If T(f) is the target and A(f) is what you have, in the frequency domain, is

T(f) = A(f) * E(f)

Were E(f) is the error correction, and

E = T / A which is really easy to do in the frequency domain. Then take the IFFT of E(f) to get e(t), the correction impulse. T(f) can be anything you like, linear phase, minimum phase, what ever.
 
When I do this, I get a perfectly flat phase plot, but no amplitude! Never seen a HOLM plot with no amplitude trace. What am I doing wrong? :scratch:

:p it's normal.
i think you're opening measurement ?
export slot A as .txt file and import directly the file.(as impulse.txt or frequency.txt)

in slot B import IR.txt from rephase.

HOLM AxB or A/B is working with .txt files (or two measurement file ) but not the mix of the two extensions.
format of measurement are not .txt.
 
Last edited:
I guess I'm missing something becuase I don't understand the need to iterate. ... loadsa textbook stuff ...
The problem is that unless your FIR is zillion point, you get something like pos's top curves in #84. This is caused by the finite length, windowing bla bla.

So you iterate by tweaking the 'target' ... I mean use conjugate search bla bla to get a better approximation to your target .. the bottom curves.

Remez exchange is a hi' falutin' name for one such method with loadsa double integrals to get into IEEE Trans. :D

An important caveat with some methods is the resultant FIR develops nasty 'edges' at the start & end but good windowing normally deals with this.

If all this sounds airy fairy and hand waving that's cos it IS! :eek:
 
Ok, I understand all that as we did it in the UE. I just didn't follow what was being iterated on. The iteration just goes back to what I was telling dlr about errors at low frequency and to change the target to compensate. Now I get it that Pos's code is doing it in an automated, iterative fashion.

We used 8192 taps in the UE with 48k sampling. But you really don't need a zillion points 8192 works very well down to about 100 Hz before errors are significant.


Here(link) is an example of what the UE can do for a 200Hz to 2k Hz band pass. I would not call it hand waving. It's all quite rigorous.
 
We used 8192 taps in the UE with 48k sampling. But you really don't need a zillion points 8192 works very well down to about 100 Hz before errors are significant.

Here(link) is an example of what the UE can do for a 200Hz to 2k Hz band pass. I would not call it hand waving. It's all quite rigorous.
This beach bum apologises for taking a light-hearted view of FIR optimisation. :mad:

It's just that there are many ways to do this and even very crude methods work well.

When I started playing with DSP, a 200 pt FIR was SOTA so I'm in awe at the zillion (8192) pts done as a matter of course these days. :eek:

Thanks for your most interesting link. If I may ask some naive questions ..
  • Were the measurements taken in an anechoic?
  • Was the EQ in the demo, Minimum Phase?
  • What is Burst Decay? CSDs are from Fincham & Berman (1978?) which we used to call KEFplots.
  • What are the 'periods' in a Burst Decay plot.
  • Is ARTA your favourite acoustic measurement package?
 
Last edited:
This beach bum apologises for taking a light-hearted view of FIR optimisation. :mad:

It's just that there are many ways to do this and even very crude methods work well.

When I started playing with DSP, a 200 pt FIR was SOTA so I'm in awe at the zillion (8192) pts done as a matter of course these days. :eek:

Thanks for your most interesting link. If I may ask some naive questions ..
  • Were the measurements taken in an anechoic?
  • Was the EQ in the demo, Minimum Phase?
  • What is Burst Decay? CSDs are from Fincham & Berman (1978?) which we used to call KEFplots.
  • What are the 'periods' in a Burst Decay plot.
  • Is ARTA your favourite acoustic measurement package?

To answer your questions in order:

1) Yes, no, sort of. The measurements were taken with the mic about 6", as I recall, from the driver so any room reflections would be in the noise.

2) The way the UE works is that minimum phase EQ is applied to the driver to make the response flat over some user specified frequency range. This can be basically DC to Nyquist. Then the target for the acoustic output is defined as a series on minimum phase filters, HP, LP, Q boost/notch, shelfs, what ever you like. Then all this is combined in to a single FIR impulse which "equalizes" the driver's acoustic output to the specified target. At that point the user has the choice to linearize phase or not. If he chooses to do so, the impulse is again modified. So in the end, a single FIR impulse does it all. If phase linearization is not selected the result is minimum phase.

3) Burst decay is the response of the system to a raised cosine burst. Each burst consists of 3 to 5 cycles at the frequency being tested. So, its a X cycle sine wave burst with a cosine shaped envelope.

4) Rather than plotting on a time axis, the axis is in periods so it scales with frequency.

5) No, it is just more convenient for things like this and generates a very nice data presentation.

Going back to 2 for the moment, this is where FIR is very powerful since trying to even approximate this degree of EQ with IIR would require many stages of biquads and you would have to worry about gain staging. With FIR we end up with the impulse for a single transfer function (TF) and all that needs to be considered is if the dsp engine has sufficient head room for the max gain of that TF. Of course the question is, do you really need to EQ to the degree the UE is capable of? That's something only time and listening will tell, along with the quality of the dsp engines. Right now the dsp engine for the UE is a PC and multichannel sound card. When the project was started and I was involved we wanted to develop hardware to take it off the PC, like what miniDSP is doing. But it was cost prohibitive. As you can see, miniDSP is charging $300 for a 2 in, 2 out board that can handle 6144 taps at 48k. Something like 2 in x 8 out with 8192 taps (or more) just wasn't in the cards. Cost of the product would have been too high let alone the cost of development.
 
It's just that there are many ways to do this and even very crude methods work well.

This is the impression I get, too. I want to do it 'text book', but what sort of difference in quality are we talking about, between an out-of-the-box crossover filter (say 4th or 8th order) with no further correction at all, and with various stages of correction e.g.

- Basic baffle step correction - I think we should notice this, but perhaps we could achieve this by pretty crude 'analogue' methods

- Phase alignment through crossover region (if it's a steepish crossover are we going to notice it?)

- Playing with delays between drivers

- Flattening of amplitude response

- Flattening of phase response

- Room correction

Basically, a three way speaker with bog standard linear phase 8th order crossover filters and judicious selection of crossover points and amplifier volume control settings, already sounds pretty damn good - and is kind of 'natural' i.e. every phase bump is probably accompanied by an amplitude bump and is caused by physical factors that our ears possibly hear past anyway. Should we be expecting a clearly better sound with the further tweaking (that a non-audiophile would notice, for example), or is it much more subtle than that?

Edit: (I know that wasn't what you meant exactly, kgrlee, but the audibility of differences between various DSP methods.)

Aside from the maths there are other variables such as mic position (obviously), degree of averaging and smoothing of measurements that the corrections are based on etc. There seems to be no definitive right answer, and one is always left with the worry that if it only sounds different, but not better, that it may, in fact, be worse. Not that it's going to stop me from doing it, obviously!
 
Last edited:
To answer your questions in order: ...

3) Burst decay is the response of the system to a raised cosine burst. Each burst consists of 3 to 5 cycles at the frequency being tested. So, its a X cycle sine wave burst with a cosine shaped envelope.

4) Rather than plotting on a time axis, the axis is in periods so it scales with frequency.
Thanks for this John.

It looks like Burst Decay is an extension of Analogue Loudspeaker Measurement with 3-D Display We called those PAFplots after Peter A Fryer.

IMHO, this gives the best representation of the most important speaker 'distortions' if you consider it as a 1D transmission chain.

The theoretical difference between PAFplots & Burst Decay is PAFplots use rectangular windowing.

Going back to 2 for the moment, this is where FIR is very powerful since trying to even approximate this degree of EQ with IIR would require many stages of biquads and you would have to worry about gain staging.
Simple Arbitary IIRs shows how you can use Direct Form I IIRs instead and gain loadsa efficiency. The design of such beasts is slightly more complicated than FIRs. :D

After all, a FIR is just a Direct Form I IIR with feedback disabled. :)

Gotta get my finger out and finish the JAES version.
_______________

John, are those stand-alone DSP boxes like the miniDSP integer only?

This is important if you are using FFT convolution cos you really need to dither at every butterfly stage.
_______________

CopperTop, high order xovers are evil for most speakers; whether analogue, digital, Min. Phase or Linear Phase. Richard Greenfield has an AES paper on the subject. IMHO, 4th order LR is already beyond the pale. I prefer 3rd order Arthur-Smythe xovers for the usual treble xover.
 
Last edited: