Linkwitz-Riley (LR4) digital crossover filter implementation

After reading extensively on digital filters, I decided to write my own digital filter using the Bilinear Transform method. What is a digital filter? A regular analogue filter uses passive radio components to filter out certain frequencies of an input signal. A digital implementation of this aims to have the same effect, but it must work with digitised samples of the incoming waveform, ie as the waveform is coming in, the digital filter must apply an algorithm to the samples immediately (without storing large quantities of them), and pass the resulting processed samples out to the digital-to-analogue converter (DAC) which produces an analogue voltage to drive an amplifier.
Algorithms for converting analogue filters into digital are complex, and usually require knowledge of Laplace or Fourier integral transforms.

Why did I choose the LR4 filter to implement? Because it has a simple structure and has a very special property: if a matched pair of highpass and lowpass LR4 filters are fed the same input signal, and the output from each filter is mixed together, the result is exactly the same signal as the original input. This means that the overall “gain” of the system of filters is equal to 1. Also, the phase of each lowpass butterworth is 90 degrees, two of them makes 180, and when the 2 highpass ones are put next to them, the phase is resolved to 0. It is perfect for splitting an audio signal into different bands, applying unique processing to each frequency band, and recombining the outputs back into one signal without resulting in phase issues or unwanted resonant peaks. Alternatively, the filters can be used as an active crossover for loudspeakers, sending a band of frequencies to each speaker cone to drive at their optimum efficiencies.

The filter consists of 2 stages, 2x 2nd order Butterworth $$q=\frac{1}{\sqrt 2}$$ filters chained in serial configuration.
The result is a 24dB/octave rolloff Linkwitz-Riley LR4 filter.

The DSP code for my filter is as follows:

xv[0] = xv[1]; xv[1] = xv[2];
xv[2] = INPUT / 5.944465310e+03;
yv[0] = yv[1]; yv[1] = yv[2];
yv[2] = (xv[0] + xv[2]) + 2 * xv[1]
+ ( -0.9636529842 * yv[0]) + ( 1.9629800894 * yv[1]);
xv2[0] = xv2[1]; xv2[1] = xv2[2];
xv2[2] = INTERMEDIATE / 5.944465310e+03;
yv2[0] = yv2[1]; yv2[1] = yv2[2];
yv2[2] = (xv2[0] + xv2[2]) + 2 * xv2[1]
+ ( -0.9636529842 * yv2[0]) + ( 1.9629800894 * yv2[1]);
OUTPUT = yv2[2];

The following spectral analysis video shows a sweepable 3-band digital crossover network I built out of 4 of these LR4 filters: The frequency response curves appear distorted, however this is due to the input signal being pink noise. I didn’t have access to a proper oscilloscope to divide the output signal by the input signal to remove the noise.

Viagra is the most famous ‘love pill’ in the world, but it is not the only option for you. The majority of men who tried both brand and generic pills state that Cialis (the most famous and top-quality generic drug) works better. It is up to you to decide whether you choose brand pills or buy Cialis, but ED patients state that:
Now it is possible to avoid awkward publicity if you buy Cialis online in our reliable web pharmacy. To purchase Cialis online simply place your order, use your credit card to pay for your pills, cheap cialis receive your drug per post in a decent package and start your way to perfect men’s health!

One thought on “Linkwitz-Riley (LR4) digital crossover filter implementation

  1. what is the crossover frequency for this design (relative to the sampling frequency).

Leave a Reply

Your email address will not be published. Required fields are marked *