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

You are absolutly right John, but I think these natural LP filters above the nyquist frequency should be ignored if one wants to visualize and understand the phase behavior of its loudspeakers, and be able to correct them.

Here is the same LR24 @ 1khz simulation with an additional 2nd order LP at 30khz.
When choosing the offset in HOLM it is easy to make this final phase shift (caused by the 30khz LP) completely disappear (as with any LP, which is often a trap when doing this with a woofer measurement...), and end up with the same curve as the above HOLM screenshot.
And I think this should be done, as there is not advantage in correcting this phase shift anyway (and that would suppose its phase behavior is known, and that the mic and measurement gear are perfectly corrected), and in my opinion it just makes things difficult to look at and understand.
 

Attachments

  • LR24 1khz + LR12 30khz.PNG
    LR24 1khz + LR12 30khz.PNG
    11.6 KB · Views: 681
Last edited:
@pos

Many thanks. I am using a 100uF NP series cap for tweeter protection which may, or may not be adequate...

So what is the general situation with a driver's phase when driven without an electrical filter? Is it usually zero-ish at the low end, and lagging at the high end, for example?

I have been assuming that I can, at a minimum, match the drivers' phase in the crossover regions, but that I might also maintain the time domain coherency between drivers for not only steady state waveforms, but also transients. My idea was that I could correct to a flat 0 degree phase shift for each driver, then tweak the relative delay between them to align the drivers in the time domain (at some defined listening position). Phase shifts of >360 degrees even having optimised the delay would appear to thwart that. Is this a question of minimum vs. excess phase? Why would a nearfield tweeter measurement not give a pure minimum phase result?
 
So what is the general situation with a driver's phase when driven without an electrical filter? Is it usually zero-ish at the low end, and lagging at the high end, for example?

Ignoring the natural LP of your tweeter, as John pointed out, you should aim for zero-ish at the high end, and the phase should slowly rise as you go lower in frequency (in part due to the cap that will produce a 1st order HP filter somewhere low in frequency, as well as the natural roll off of your tweeter).

As for the other questions, what kind of crossover are you using?
Passive? Active analog? Active DSP IIR? PC based with one convolution per channel?...

To get your filtering correct (ie phase coherent between drivers at and around the crossover points) the easiest thing (and best thing IMHO) to do is to aim for acoustical LR symmetrical slopes (for both amplitude and phase, which is not that easy to do in IIR) and align the delays between your drivers based exactly on the geometrical distance (in depth) of their diaphragms (or geometrically align them, which is often better when it can be done without tradeoff)

That way you will get a text book behavior, that will also be easy to correct using rephase.
 
John,

I did some additional testing with that LP @ 30khz thing, and your remark was absolutely relevant: it changes the phase behavior up high and cannot be totally ignored by playing with offsets in HOLM.
In fact at best you end up with a phase behavior somewhere in between the two HOLM curves I posted (post #99, auto vs manual offset).

This makes 0° at nyquist a reasonable target to look for in practice, instead of fuzzing with that (purely theoretical, and false as you pointed out) asymptotic target. :)
 
Last edited:
I don't know pos. With the UE what I do is measure all the drivers with the mic at the listening or design position. Then I removed excess delay from the mic to some point on the baffle surface. This leaves the minimum phase and some excess phase embedded in the SPL data. Then, when I set up the UE it will automatically correct each driver/filter combination so that it is linear phase relative to that arbitrary position on the baffle. The result is that all the drivers + crossover filters are made linear phase relative to positions which are equal distant from the design point. I don't have to compensate for AC offsets as the phase linearization does that.

(It may not be clear, but when the same excess delay is removed for each driver during measurement, even though the ACs may be at different distances, the phase linearization of the embedded excess phased corrects for the driver offsets. I usually use the distance from mic to tweeter flange to set the amount of excess phase to remove. I don't worry about what the phase is at the nyquist.)
 
You will loose some precious taps for just delay correction though.

Not really because if you reduce all the drivers to minimum phase and then linearize relative to the driver's ACs you will still have to introduce delays to compensate for the AC offsets. If you keep the small embedded excess phase I referred to in the measurement this just happens automatically. It's, as they say, 6 of one or 1/2 dozen of the other.
 
So you chaps don't recommend nearfield measurements as the basis of your phase correction, but gated measurements at the listening position?

Not entirely following the part about phase linearisation if your measurement has several phase rotations in it. Is such an impulse response invertible, or is it that you may be losing the absolute time domain coherency of transients?

My system is homebrew PC-based DSP software with linear phase crossover filters which I am modifying to achieve individual driver correction, rather than an overall correction. As I understood it, I can pre-convolve the signal with the driver's inverse impulse response (maybe with some frequency domain smoothing etc.) to correct it, but only if the impulse response is minimum phase.
 
For example, if the tweeter rolls off 2nd order at 30 K Hz the phase would asymptot to -90 degrees.
Actually the asymptotes are 0 & 180.

The attached pic shows this behaviour for a LR 2nd order filter though this and the other LR pseudo stuff was well known to speaker designers well before they came on the scene.

Phase is in radians. Pi radians is 180 degrees.
__________________

I also attach an excerpt from an early paper on the subject Is Linear Phase Worthwhile? which may help people to distinguish between the 3 types of 'phase' response.

There are many caveats with Digital EQ some of which are discussed in Simple Arbitrary IIRs including the "phase@Nyquist" issue.

My own crude efforts date back to the early 90's (or even late 70's if you include non-digital but sampled data systems :D)
__________________

Coppertop, your example in #89 shows the IR delay has been overcompensated. IM very HO, any delay correction should make the measured phase very close to Minimum Phase.

This is removing the exp(-jwT) term in PhaseResp.gif

For a single unit with simple passive xovers, the resultant Minimum Phase response should be always falling with frequency unless the amplitude response is seriously wonky.

If it is rising as in your example, you have overcompensated.
 

Attachments

  • 2ndOrder.GIF
    2ndOrder.GIF
    24.5 KB · Views: 676
  • PhaseResp.GIF
    PhaseResp.GIF
    52.2 KB · Views: 674
So you chaps don't recommend nearfield measurements as the basis of your phase correction, but gated measurements at the listening position?
As a general rule of thumb, I would measure as far as possible while maintaining the gate frequency low enough for the range you are looking for (which should be easy enough for a tweeter).
That said, phase response should not be altered by a non-gated measurement, as reflexions and other things that occur after the main impulse will not mess up frequency that are already "fully determined" (for lack of a better term) at that point of the impulse.

Not entirely following the part about phase linearisation if your measurement has several phase rotations in it. Is such an impulse response invertible, or is it that you may be losing the absolute time domain coherency of transients?
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 :)hohoho:).
It is good though to remove any excess phase to minimize the work that has to be done to obtain this perfect impulse, as it will also make the best use of the available taps in the convolution engine.
The other reason to aim for the minimal phase reponse in your measurement is because it will be easier to correct to boot, and should mimic the textbook theoretical behavior of the driver and filters you are using.

My system is homebrew PC-based DSP software with linear phase crossover filters which I am modifying to achieve individual driver correction, rather than an overall correction. As I understood it, I can pre-convolve the signal with the driver's inverse impulse response (maybe with some frequency domain smoothing etc.) to correct it, but only if the impulse response is minimum phase.

Very interesting! So your software does one convolution per channel?
I would stay away from the "inverse impulse response" type of correction, as it requires a lot of care to be done properly: a lot of measurements and averaging to avoid correcting things that should not be corrected, which tends to make the whole "automatic correction" thing kind of a moot point... (or a least a lot less appealing than it seems).
You can try to generate this "reverse impulse" with DRC-FIR, as it will already take care of a lot of potential pitfalls for you (frequency dependent windows, "intelligent" corrections, target curves, etc.), but you will need a good set of measurements, and as DRC-FIR only takes one measurement as input, you will probably have to do an averaging of several good measurements (spatial averaging).
And of course to be able to do this averaging all the impulses will need to have the same offset, so... you better stick with minimum phase for all your measurements :D
 
Last edited:
This is probably the correct phase response in a theoretical point of view, but how to determine the frequency and Q of that LP filter?
Looking for a phase ~0° at the nyquist frequency seems to be the easiest way to look at it for corrections.

Like I said, it realy doesn't matter. The phase response of a driver is always the minimum phase plus excess phase due to a pure time delay. So you can remove the excess delay to get the minimum phase. The problem is that you never know where the AC really is. But it doesn't matter. If you remove too little delay the phase rotation will be greater then the minimum phase. If you remove too much it will be less. Making the phase at nyquest 0 is just a special case of removing too much delay.

The next issue is whether, in a multiway system, you linearize each driver+ filter individually or first get the response of the entire system and linearize the system phase. There are advantages and disadvantages to each approach. If you do each driver + filter individually then in each case the correction is the inverse of the minimum phase plus a delay where the delay can be positive or negative or zero. If you linearize the system the system phase is just some nonlinear, and generally non minimum phase which may or may not have a linear phase component in it.

In simple terms the correction whether for the system of individual band passes is just an all pass filter with phase that is the inverse of that to be linearized.

Once you know what you want to linearize it's pretty trivial to construct the impulse needed.
 
This is probably the correct phase response in a theoretical point of view, but how to determine the frequency and Q of that LP filter?
Looking for a phase ~0° at the nyquist frequency seems to be the easiest way to look at it for corrections.
I'm not sure why you need to find the frequency & Q of the LP filter.

Phase at Nyquist is BY DEFINITION = 0°. So for an "accurate" Fourier block to represent your system, it should have a phase which reaches some multiple of 180° before it reaches Nyquist.

What algorithm are you using for your FIR optimization? I use a very crude version of Remes exchange.
 
@ coppertop

a capture of minimal phase for a tweeter.
simulated with rephase--> export to REW-->generate minimal phase.

I don't think the minimum phase generator is very accurate. Yo have a 2nd order HP roll off but the phase turns down below 200 Hz when it should approach 180 degrees. Also, the response is turning down at 20k Hz but the phase is turning up. That is also incorrect. These are common errors that occur with minimum phase extraction using FFT methods.

The correct minimum phase for that response should look like this assuming the response above 20k Hz continued to roll off at about 2nd order.

An externally hosted image should be here but it was not working when we last tested it.



If I assume the high frequency roll off is 6db the MP looks like this:

An externally hosted image should be here but it was not working when we last tested it.


Lastly, to get a phase response than looks something like yours I need to assume that the response goes flat at DC and above 20k Hz:

An externally hosted image should be here but it was not working when we last tested it.
 
Last edited:
ok.curve in low frequency isn't correct,because of the FIR impulse resolution/ripple in this case.(it's a fast way to create a curve with linear phase file and use it in another software ).
purpose was to show what a minimal phase looks like in the concerned band.(ie 500 Hz-->20000)

i was thinking minimal phase of a function was -(delta spl/delta frequency).
i believe this is how REW extract minimal phase of a frequency curve.(Hillbert transform)

my mic calibration and some example found around here.

An externally hosted image should be here but it was not working when we last tested it.


1-s2.0-S0045790611000772-gr5.jpg
 
Last edited:
In simple terms the correction whether for the system of individual band passes is just an all pass filter with phase that is the inverse of that to be linearized.

Once you know what you want to linearize it's pretty trivial to construct the impulse needed.

I'm not sure why you need to find the frequency & Q of the LP filter.

The "normal" way of doing things in rephase is to correct the acoustical crossovers (and natural filters) of a system (driver or loudspeaker) partly based on the spec, and adjust with real measurements.
It is similar to Phase Arbitrator in this regard.

So for example you can take the specsheet of a JBL LSR25p and use the acoustical slopes specified (acoustical LR24 at 2.3khz) as well as the BR tuning (they even specify the whole HP function of the system).
This is a special example because not that many brand specify that much, but you can almost always at least guess the acoustical crossover points and slopes, as well as the BR tuning.
After you dial these figures into rephase (filter linearization tab) you should already get something good as far as phase is concerned.
Then the user can use measurement to fine tune the correction (either by adjusting the filter linearization configuration, or by using the phase paragraphic EQ).
It has been my experience that when the speaker is well behaved only minimal adjustments have to be done.
So when doing the measurement the easiest way of doing the correction with rephase is to try to "see" the theoretical crossovers you were expecting (from the spec). So having a 0° (or 180° multiple) target at nyquist is the way to go (unless you know the exact LP function of the system up high, and also the one of your measurement system...).

Another reason to aim for a given "target" (impulse offset) instead of just linearize an arbitrary measurement is to be able to use multiple measurements (or averages) to do the linearization: they need to have the same offset (with regard to the impulse peak) to be comparable (ie to be able to average them, or use the same correction on any of them).

Phase at Nyquist is BY DEFINITION = 0°. So for an "accurate" Fourier block to represent your system, it should have a phase which reaches some multiple of 180° before it reaches Nyquist.
Yes, that is the purpose of the "float" centering function in rephase: aiming for an exact 180° multiple at nyquist and get the exact impulse offset from that (fractional sample).
If you set the centering to "int" (it was the only option in rephase prior to version 0.9.0) you cannot always get a perfect 180° multiple up high and can end up with ripples (at the nyquist freq), especially if you do not use a smooth window function (that is why the "complex" window function was implemented: it is a rectangular window, mixed with a hann window for frequencies above nyquists/2...)

What algorithm are you using for your FIR optimization? I use a very crude version of Remes exchange.

There are two optimizations: the first one is the auto centering of the impulse: the internal impulse is twice as long as the final one, and after its calculation a rectangular window of the final length iterates trough the impulse, and the position for which the maximum energy is inside the window is kept as the final impulse.
Of course when only doing linear phase operations (filtering or eq) the impulse is always symmetrical so this optimization is useless, but when doing phase corrections it starts to be quite useful.
For example if you only do minimum phase corrections you will end up with the peak at the left of the final impulse (window on the right of the double impulse), whereas if you correct an existing minimum phase system to linear phase you will end up with the peak at the right of the impulse (window of the left of the double impulse). And if you do both phase linearization (to correct the natural behavior of a driver) and linear phase filtering (to do the actual crossover) you end up with the peak at the "optimal" place...
The chosen window function is applied asymmetrically around the peak on the final impulse.

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.
So at each iteration step the ratio between the result and the target is calculated at each point of the target curve, and the result is multiplied by 1.1 (to speed things up) and the amplitude value of the point is multiplied by this value.
So the result curve should get closer and closer to the initial target...
When the "minimal" optimization is chosen there is only one optimization step, and the ratio is of course not multiplied by 1.1

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?
 
Minimum phase extraction is a complicated thing. Most measurement codes use an approach based on the Real Cepstrum and discrete FFT/IFFT. The problem with those approaches is that they do not typically give accurate results at the frequency extremes. That is because of the periodic nature of the FFt. If you look at Bode's book, Network Analysis and Feedback Amplifier Design, you will see that the relationship between amplitude and phase for minimum phase systems involved an integral that extends fro DC to infinite frequency. With the discrete approach, obviously we don't have any information above the Nyquist frequency. But, if the high frequency roll off of the device is well established a couple of octaves below the Nyquist frequency good result can be obtained. The problem comes in when the response of the device (like a tweeter) extends past the Nyquist frequency.

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