N-band Linkwitz-Riley crossovers

DSP, Plugin and Host development discussion.
RELATED
PRODUCTS

Post

Nice, yeah that seems possible - but on the other hand then the bands will require extra processing when summing them back, and also the bands will be out of phase while processing them independently..

However, as you increase the # of bands, this optimization scales actually! So that may be an option if you want to scale back the CPU usage.

Post

For the serial case, it may be possible to cascade the lowpasses instead, which should offer "more precision".

The biquad filters in Reaktor have a resonance tuning from 0 - 1. I am trying to figure out how to translate that to Q/bandwidth.

Post

There is a tutorial on multiband splitters at http://flowstone.guru/downloads/multi-b ... -tutorial/ where the use of allpasses is explained and demonstrated. You will need Flowstone to fully appreciate, though. FS tryout version will suffice.

Post

martinvicanek wrote:There is a tutorial on multiband splitters at http://flowstone.guru/downloads/multi-b ... -tutorial/ where the use of allpasses is explained and demonstrated. You will need Flowstone to fully appreciate, though. FS tryout version will suffice.
Thanks for sharing, I don't have flowstone so perhaps you could elaborate on the differences/similarities to the discussed method?

Post

I'll ty to summarize the main points:

1. You need allpasses for the bands to add.
2. For each bandsplitter you need an allpass at the opposite branch.
3. Doing it the naive way the number of components grows very fast for each additional band.
4. There is a smart way to do it. The trick is to place allpasses as close as possible to the root.

Here are two references with more details:

Complementary N-Band IIR Filterbank Based on 2-Band Complementary Filters,
Favrot, Alexis and Faller, Christof, IWAENC 2010 Proceedings.
http://www.iwaenc.org/proceedings/2010/ ... ds/975.pdf

The digital all-pass filter: A versatile signal processing building block
P. A. Regalia, S. K. Mitra, and P. P. Vaidyanathan,
IEEE Proceedings Vol. 71 (1) 1988.
http://faculty.cua.edu/regalia/regalia- ... jan-88.pdf

Post

I realise I'm a little late to this party, but I thought I'd still try to explain how this works, since it's actually much less complicated than it first appears.

They key is to think in terms of the underlying Butterworth filters, which (for any given cutoff frequency) all share the exact same pole configuration (and only differ in terms of zeroes). Then if we filter one signal with two low-pass filters (of order k each) and two high-pass filters (of order k each) in parallel paths and add these together, then we have a total of 2*k poles, half of which cancel out with the resulting zeroes(!) and the remaining ones forming an all-pass; one set of the duplicate poles cancel out with the minimum-phase half of the zeros (which form a circle; recall that Butterworth filters have their poles in a half-circle) and what remains is a Butterworth all-pass (of order k). In digital domain BLT preserves this "magical" property.

In other words, for Butterworth filters we have: LP(w)*LP(w) + HP(w)*HP(w) = AP(w). This is the key to N-band cross-overs.

Suppose we want to build a 3-band cross-over. We can split the high-band from the main signal with one 2-band cross-over and insert another 2-band cross-over in the low-mid part to split it further into low and mid. When we add these two together, the result is a Butterworth all-pass filter response (with cutoff at the low-mid cutoff). So all we have to do in order to match the phases for the high-band is to pass the high-band signal through an identical all-pass filter!

So for the N-band case, if you split-off one band at a time (and for audio purposes I would suggest you keep splitting off the high-end of the un-split signal, because this way the lowest band gets the highest order filtering, which plays well with our hearing*), then each time you split off another band, you pass all the previously split bands through an all-pass that matches the cross-over used at this point. This keeps all the phases perfectly "in sync" and will give you a flat sum for arbitrary number of bands.

There is another interesting optimisation possible: You can completely skip the high-pass filters and instead just process the double low-pass in parallel with a (single) all-pass for the band you are splitting further. The high-pass part of the band is then simply the difference between the all-pass and the (double) low-pass signals (which works for the same reason the flat summing works). This leads to one possible algorithm: split additional bands from the low-end by double-lowpass filtering (with Butterworth) the lowest current band to build a new lower band, then all-pass filter all the previous bands (with a matching cutoff) and then subtracting the newly formed lower band from the second lowest band (ie. the previous lowest band).

While this seemingly requires a triangular (rather than linear) number of component filters (which you can't avoid if you actually need to output the separate bands), there is a final optimisation possible if (and only if) you also control the final summing (that is, you are doing multi-band processing rather than just splitting for external use): since at any point you are applying an identical all-pass filter to "all existing bands" you can actually process these bands as you split them off, then add them to a summed "processed" signal, which only needs further all-pass filters applied once (ie. you only need to track two signals: one is the unprocessed one from which you split further bands, the other one is the processed band which gets all-pass compensation filters applied). In this special case the number of filters required is linear with the number of bands (specifically 2xButterworth low-pass for the new band split, one Butterworth all-pass for getting the high-pass and one Butterworth all-pass for compensating the sum of the previously processed bands). :)

*) one can argue about this and it's not the most important thing, but most people would intuitively think of splitting as a binary tree and I feel this just makes things more complicated in practice, in addition to placing the (slightly) steeper cutoffs at the mid-frequencies; for parallel implementation purposes I would suggest software pipelining instead.

Post

Hey mystran, and thanks for chiming in.

I really feel like a lot of this stuff comes much more naturally if have a fundamental understanding of the complex representations of the filters (and not just trying to reason about phase/resonance etc) so I appreciate you covering the theoretical approach.

As said, I happened to use svf filters so you get free lowpass and highpass simultaneously anyway - and I can definitely see there are possible tricks if you control the summing stage (I need the bands aligned separately unfortunately)! I guess this is also a luxury designers for speaker crossovers never had.

Post

Mayae wrote: As said, I happened to use svf filters so you get free lowpass and highpass simultaneously anyway.
While this works well for 2nd order cross-over, it's still kinda cheaper to just stack two one-poles (you can get the all-pass as a "separate output" from the first one). For anything higher order (ie. most applications given that a two-stack of one-poles are not a very good cross-over filter) you typically decompose to 2nd order sections and it's an even bigger win.

Post

mystran wrote:
Mayae wrote: As said, I happened to use svf filters so you get free lowpass and highpass simultaneously anyway.
While this works well for 2nd order cross-over, it's still kinda cheaper to just stack two one-poles (you can get the all-pass as a "separate output" from the first one). For anything higher order (ie. most applications given that a two-stack of one-poles are not a very good cross-over filter) you typically decompose to 2nd order sections and it's an even bigger win.
Wait, this is interesting. Originally I wanted to compose the structure out of one-poles both for efficiency and flexibility (and of course the nice identity that two cascaded one-poles = 0.5 Q two-pole). But I couldn't figure out how to design the complimentary highpass outputs - also why I asked that as the 'bonus question'.

If you can derive both the allpass and the highpass somehow that could be great:
(you can get the all-pass as a "separate output" from the first one).
Would you mind sketching a simple crossover using one-poles with ap, lp and hp outputs?

Post

Hope this is useful for one pole filters:
Image
That's a diagram of a multimode one-pole - allpass is lowpass minus highpass (highpass minus lowpass inverts phase). In code:

Code: Select all

//init state
s = 0.0;
//calculate coefficients 
g = tan(pi * centerFrequency / sampleRate);
g/=(1+g);
g2 = g*2;
//process loop
lp = input*g + s;
hp = input-lp;
ap = lp-hp;
s = (input-lp)*g2+s;

Post

matt42 wrote:Hope this is useful for one pole filters:
Image
That's a diagram of a multimode one-pole - allpass is lowpass minus highpass (highpass minus lowpass inverts phase). In code:

Code: Select all

//init state
s = 0.0;
//calculate coefficients 
g = tan(pi * centerFrequency / sampleRate);
g/=(1+g);
g2 = g*2;
//process loop
lp = input*g + s;
hp = input-lp;
ap = lp-hp;
s = (input-lp)*g2+s;
Excellent, thanks a lot! I've made similar highpasses before, but I always thought it was 'cheating'.. Nice to know about the allpass. I guess you can generalize this structure for any cascaded order? Would the input forming the hp then be the original or the output from the first lowpass?

Post

Mayae wrote:I've made similar highpasses before, but I always thought it was 'cheating'
Well, so long as the design method is equivalent to the BLT (this filter is designed with trapezoidal integration, so is equivalent) then the resulting high pass will have the phase and frequency response of a BLT high pass, so it's correct in that sense.

I didn't see mentioned that LinkwitzRiley is Butterworth squared (edit: I see it's in Mystran's post). In other words for the correct response we need two Butterworth filters in series. So if we use one pole sections the we need run though two lowpass, for lowband and two for highband. To retain the correct response. For second order sections we need butterworth 2nd order, q of 0.707, and as above we need run though two lowpass, for lowband and two for highband. The summed high/lowpass is an allpass filter. This means if we further split the high band to high and mid then the summed high and mid is phase shifted and will no longer sum to all-pass when summed with the low band. In that example we can add a single butterworth allpass (set to the same frequency as the high/mid band) and apply this to the low band. This phase shifts the low band in the same manner as the summed high/mid band and we can now sum all bands to allpass.

So a one pole (actually there is no one pole LR filter. This is second order with q of 0.5) two band splitter would look like this:

Image

and three band with one pole sections:

Image
Mayae wrote:Would the input forming the hp then be the original or the output from the first lowpass?
Added the block diagram as that might help with that question? Wasnt exactly sure what you meant.

Maybe check these:

https://en.wikipedia.org/wiki/Linkwitz% ... ley_filter
and maybe this old thread:
viewtopic.php?t=278736

Edit: Thanks, Mystran. Just read through your optimization tips with a clear mind. That would be handy if I ever need to use this.
Last edited by matt42 on Thu Mar 02, 2017 1:54 am, edited 1 time in total.

Post

matt42 wrote:
Mayae wrote:I've made similar highpasses before, but I always thought it was 'cheating'
Well, so long as the design method is equivalent to the BLT (this filter is designed with trapezoidal integration, so is equivalent) then the resulting high pass will have the phase and frequency response of a BLT high pass, so it's correct in that sense.
Great to know, thanks.
Mayae wrote:Would the input forming the hp then be the original or the output from the first lowpass?
Added the block diagram as that might help with that question? Wasnt exactly sure what you meant.
Ah, was talking about the equations - so to generalize for any (BLT) filter, this holds?

Code: Select all

lp = filter(input);
hp = input-lp;
ap = lp-hp;

Post

Mayae wrote:]Ah, was talking about the equations - so to generalize for any (BLT) filter, this holds?

Code: Select all

lp = filter(input);
hp = input-lp;
ap = lp-hp;
Well, in the case of one pole, yes.

Code: Select all

//one pole transfer functions:
//lowpass transfer function
1/(1+s);
//highpass transfer function
s/(1+s);
//input-lowpass transfer function
1-1/(1+s);
//simplifies to
s/(1+s)//high pass
BLT preserves the frequency and phase responses, but warps the frequencies. So, if input - lowpass = highpass, for example, then BLT will preserve that relationship. For higher orders these relationships most likely aren't there

Post

Yep, IIRC 2nd order or higher, [Input - LP] tends to result in a highpass about -6 dB per octave. The highpass is degraded because of the higher-order phase shift, resulting in "not very good" subtraction of lows from the broadband signal.

In some cases perhaps the assymetrical cutoff slopes could be desirable, dunno.

I like MyStran's idea about higher order filters-- "Apply lowpass to the Input; Apply allpass to the Input; Derive hipass by subtracting lowpass output from allpass output."

Have not tested, but that "seems like" it ought to work nicely. Captain Obvious says that for a second-order lowpass, use a first-order allpass, and for a fourth-order lowpass, use a second-order allpass.

Been busy with some woodworking and carpentry, but began wondering whether a "flat-summing" multi-band crossover (containing phase shifts which "line up with each other" such as Linkwitz-Riley) would be really much of a benefit for instance multi-band dynamics processing. Would like to test more closely sometime.

It ought to be fine for speaker crossover or other applications where the mix level of the different bands stays fixed during the processing run. But applications which "quickly" change the mix levels of the bands during playback--

For instance a simple 2 band crossover which mixes flat-- First-order crossover or higher-order Linkwitz-Riley-- For a first-order crossover, if at some moment the high-output gets heavily compressed then the mixed output phase at the crossover frequency would approach -45 degrees. But at some other moment if the low-output gets heavily compressed then the mixed output phase would approach +45 degrees.

With a second-order LR, it would be the same except phase could be dynamically modulated up to +/- 90 degrees. With fourth-order LR, the mixed output could be dynamically modulated up to +/- 180 degrees.

This dynamic phase shifting ought to be most obvious in the vicinity of the crossover frequencies. I did some research on old tube-tech vibrato units from the 1950s/60s, and such as the tube vibrato unit in wurlitzer electrostatic reed organs-- Those devices could make "fairly strong" true pitch vibrato by allpass-modulating the phase a mere +/- 45 degrees.

So a Linkwitz-Riley based multiband dynamics processor at least in theory ought to be capable of rather extreme transient pitch shifts if the processor is pumping heavily. The transient pitch shifts ought to be "most obvious" in maybe an octave or two in vicinity of the crossover frequency for a first-order crossover.

Higher-order crossover transient pitch shifts might be be "most obvious" over narrower frequency ranges. OTOH higher-order crossovers would have more-extreme phase modulation over this narrower frequency range, so perhaps transient pitch shifts could sound "worse" if the processor is pumping hard, even if a smaller frequency range is strongly pitch shifted? Or maybe steeper slopes would help hide transient pitch shifts?

Dunno how audible such pitch artifacts might be. Perhaps less-audible with modest fairly slow gain changes and more-audible with heavy or faster gain changes? Perhaps less audible on non-pitched drums or mono instruments, bass, vocal, sax? Perhaps more audible on strongly-pitched poly instruments such as acoustic piano?

Post Reply

Return to “DSP and Plugin Development”