News:

SMF - Just Installed!

Main Menu

How to build a linear-phase crossover in three easy steps !

Started by Tranquility Bass, January 29, 2025, 05:26:30 PM

Previous topic - Next topic

Tranquility Bass

Using Audioweaver, the Ultimate Preamplifier, and rePhase, we were able to implement a linear-phase crossover on the onboard SHARC DSP running at 192 kHz without much effort at all. For this example, we chose a simple 2-way crossover centered at 1 kHz and a response that mimicked an 8th-order Linkwitz-Riley filter, in which both sections exhibited an in-phase response of -6 dB at the crossover point.

Although both the non-minimum phase version and the linear-phase version of the Lintwitz-Riley crossover have identical summed flat magnitude responses and are also in-phase at the crossover frequency, the linear-phase crossover, as its name suggests, has a linear phase response. This means that once both the low and high pass sections are summed together, the total output is just a delayed version of what is being fed into it. This is in contrast to the non-minimum phase version, which distorts the signal passing through because of its non-constant group delay. This linear distortion should not be confused with non-linear distortion, such as harmonic or intermodulation distortion.

Linear phase filters are a special class of FIR filter that sums to a unity response with a fixed time delay. So when both high-pass and low-pass sections are added together, the response is a delayed version of what is being fed into the crossover. As I have discussed in another thread, this type of filter can have issues with proper impulse response cancellation due to imperfect matching between drivers, which can result in pre-ringing leakage among other issues. The proponents of these types of filters will never talk about this aspect of this type of filter topology, instead pretending that it doesn't exist or is inaudible. Whilst pre-ringing at ultra-sonic frequencies in DAC reconstruction or oversampling filters, etc, is essentially inaudible, pre-ringing at audible frequencies in loudspeaker crossovers can be audible and unwelcome!

As in the group-delay corrected filter, this time we use rePhase to create the linear-phase FIR filter coefficients as in the following setup:-

Rephase_UP2_192k_2048_1kHz_48dB.png

RePhase can create complementary high- and low-pass filters. However, we will use a simple trick of subtracting the high-pass filter output from a delayed version of the filter input to create the low-pass complementary filter output without requiring twice the computation resources! This is crucial when using lower-powered DSP devices such as the SHARC DSP used in our preamp.

We set optimization to "Moderate" and hit the "Generate" key, and then we create the following correction filter! Note that rePhase always creates a correction filter with a net 0-phase response! This results in a non-causal impulse response that occurs before the impulse, which, whilst mathematically succinct, is physically unrealizable. To overcome this, rePhase allows you to realign the impulse response by delaying it and windowing it so that no response occurs before the impulse. In this case, this was done by delaying and centering the impulse response at the halfway point (i.e., half tap count) and using a Hanning window to mask out anything before the impulse. The delay of exactly half the tap count of the filter is what we use to subtract from the output of the filter to create the complementary low-pass filter, and later, when we measure the outputs of the filters, you will see they are both complementary filters with identical slopes. When summed together, we get a unity output with a linear-phase response! Now we just have to enter the filter coefficients into Audioweaver using the following test bench we have created to illustrate one channel only.

FR_UP2_192k_2048_FIR.png

The highlighted green connection lines show the signal path for the high and low-pass filter sections, consisting of the FIR high-pass filter section and the low-pass section, which subtracts the high-pass from a delayed version of the input signal to create the low-pass filter. And we also include the delayed filter input and summed outputs routed to the other unused preamplifier outputs, which facilitate measuring the filter response. This helps us do differential phase tests; otherwise, the net phase response contains so much delay that it is very hard to visualize the shape of the phase response curve. For those playing along at home, the resource usage for this 2048 tap FIR filter is quite modest at only 14% ! And for a stereo version using identical coefficients for both channels as you would normally use, the SHARC DSP supports SIMD instructions, which means that it can process two multiply-accumulates (MACS) in one clock cycle so we would expect there would be no increase in resources for a stereo version of this filter !

AWE-CPU_UP2-192kHz_FIR-2048.png

The magnitude response of both the low and high pass filters from the dScope analyzer is shown below. The blue trace is the low-pass filter response, and the red trace is the high-pass filter response, whilst the grey trace is the summed response, and the orange trace is the relative phase difference between the summed output and the delayed input:-

FR1.png

Now, here are some test results from the scope at various frequencies. The yellow trace is the delayed 1 kHz square-wave input signal. The blue trace is the low-pass filter output. The magenta trace is the high-pass filter output. As expected, the bottom green trace is the summation of both the low and high-pass sections, which, of course, is identical to the delayed input signal!

250129_1.png

250129_3.png

250129_4.png

One thing that should be abundantly clear in the traces above is the amount of pre-ringing or the response before the leading edge of the square wave that these filters exhibit, and which is not present in the IIR version, which is also shown below for comparison! In theory, this may not be an issue on-axis where both speakers crossover with essentially a uniform frequency response, and the pre-ringing should essentially cancel out, but this cannot be guaranteed off-axis, so we would expect imperfect impulse response cancellation to occur and some pre-ringing to leak through. However, maintaining a perfect uniform on-axis response would also be a significant challenge, especially as the speakers' characteristics drift over time with no mechanisms to correct for this. Whilst pre-ringing at ultrasonic frequencies in a DAC reconstruction filter is inaudible, pre-ringing in the audible bandwidth is not! Now let's compare this with the non-minimum phase Linkwitz-Riley 8th-order filter!

Shown below the top yellow trace is the input signal, which is the leading edge of a square wave. The blue trace is the low-pass output of the linear phase filter, while the magenta waveform is the low-pass filter output of an 8th-order non-minimum phase LR crossover (LR-8). Note how the LR-8 filter has no output before the leading edge, while the linear phase variant exhibits pre-ringing energy before the leading edge! This is because a linear-phase filter always has a symmetrical impulse response. In contrast, as used in the non-minimum phase variant, a causal recursive filter cannot have a symmetrical impulse response, which is why it produces nothing before the impulse.

250223_1.ssd.png

Now we compare the high-pass filter sections of the same crossover. Again, the top yellow trace is the input signal, which is the leading edge of a square wave. The blue trace is the high-pass output of the linear phase filter, while the magenta waveform is the high-pass filter output of an 8th-order LR crossover (LR-8) implemented using IIR filters. Note how the LR-8 filter has no output before the leading edge, while the linear phase variant exhibits pre-ringing energy before the leading edge!

250223_2.ssd.png

The issue here is that unless two speakers are perfect both on and off-axis, you will always get imperfect impulse response cancellation and thus have issues with pre-ringing artifacts, which are totally unnatural and can be audible !! The reason you use a crossover in the first place is that drivers aren't perfect devices; you need to attenuate their out-of-band characteristics as much as possible, and the last thing you need is the crossover introducing potential artifacts at the crossover frequencies, which the speaker drivers can reveal !

Whilst pre-ringing at ultrasonic frequencies, such as that from a DAC reconstruction filter, is essentially inaudible, pre-ringing at audio frequencies is not! This is why FIR filters with cutoff frequencies selected to fall within the audible band could be problematic! Note the absence of this issue from protagonists of these types of filters. They will argue that pre-ringing is not audible below a certain threshold, which they don't quantify, let alone admit even occurs. To put that into perspective, let's have a look at the frequency response of a typical premium quality midrange driver shown below. This driver and its variants have been utilized in numerous high-end speaker systems. Even if we applied high-order linear phase filters to filter out the undesirable out-of-band anomalies, the in-band response still shows quite a bit of response irregularity, thus bringing into question its ability to suppress pre-ringing entirely.

FreqRespMidrange.png

Now to answer a long-lost question that was posted on our www.diyaudio.com thread at the time of our pre-order for the UP2 and UPP some years back and by what appears to be a protagonist from the DIQX camp that obviously had no intention of buying anything from us other than a desperate attempt to dissuade people from it then yes it is not true as stated by this individual that it is hard to implement a linear phase crossover on our preamp using Audioweaver. As the preceding demonstration illustrates, it is quite simple, but of course this type of filter comes with some caveats of its own, which have already been highlighted by a number of esteemed audio engineers, so with the Ultimate Preamp, you get to choose your poison.

QuoteSecond, what I really like about my DIQX crossover at the moment is the implementation of linear-phase crossovers (FIR). The software treats it just the same as Linkwitz or Butterworth crossovers. Just choose it from the list, that simple. All other DSP solutions so far expect you to be a DSP expert to be able to implement linear phase crossovers. I was looking for this in audioweaver but so far have not found it yet. Maybe I'm missing something. Now before anyone likes to discuss the downsides of linear phase crossovers and why I would want them but there is only one simple answer: Because it sounds better in my system and except from linear phase crossover I can't think of anything why I would need the amount of DSP power that is on offer in the Ultimate Preamp

Sorry, but you are misinformed. You don't have to be a DSP expert to implement a linear phase crossover. In actual fact, you don't have to write a single line of DSP code as the above example demonstrates. Applications such as Audioweaver, as used by the Ultimate-Preamp, encapsulate all of the low-level DSP code for you, but if you still want to whine about that, then perhaps you should not get involved with DSP and active speakers in the first place ;)

And from another thread about DSP.

QuoteREW and Acourate are at the opposite end of the spectrum. Both are very manual tools, and the tools need to be deployed in the correct order and in the correct situation. When I say "manual", I mean that you have to inspect the measurements yourself and decide what you want to do. Acourate has a few more "luxury" features compared to REW, which is why I prefer it. REW can not be used on its own, you need RePhase. Both are extremely flexible, but also close to impossible to use if you do not know what you are doing.

Sorry, but our example above disproves this statement as an exaggeration of the truth. As I have demonstrated, a little bit of elbow grease gets you a simple linear-phase two-way crossover straight off the bat without much effort at all. Not only that, you do not need any additional convolver software, as Audioweaver provides all of the necessary modules to begin with. Similarly, it is easy to compare one filter topology with another and run different filters concurrently as we did above when we directly compared the linear-phase LR-8 FIR-based crossover to the non-minimum phase LR-8 IIR-based counterpart. Alternatively, you could easily construct a multi-way crossover with non-minimum phase IIR filters and then apply global phase correction to linearize the phase as we did in our example on another thread. In each case, it is not difficult to do using Audioweaver and free software such as rePhase. Anyone telling you otherwise either doesn't understand or has ulterior motives to push people towards a particular brand of software or hardware which is probably why this person never mentions Audioweaver, or if they do, they then dismiss it as being overly complicated and aimed at engineers and as shown above nothing could be further from the truth. Have a nice day ;)





















Analog-Precision Taking Audio Reproduction to the Next Level.......