It is required to design a second order digital allpass filt
Solution
Second-Order Allpass Filters for Phase Alignment Richard Taylor August 2015 1 Introduction Phase alignment is an important part of an audio crossover design. Although crossovers are generally designed so their electrical outputs sum in-phase at the crossover frequency, several factors (e.g. physical offset between drivers, electro-mechanical response of the drivers and enclosure, phase shifts introduced by equalization filters) can contribute relative phase shifts between drivers so that the acoustic signals at the listening position no longer sum in-phase. Typically, phase alignment is corrected (if at all) by applying a delay or first-order allpass filter to one of the drivers. These filters each have just one control parameter; consequently the resulting phase alignment can be made exact at just one frequency: the phase alignment is correct to “zeroth order”. A better (“first order”) alignment over a broader range of frequencies in the crossover band could be achieved with a two-parameter allpass filter, which permits control over both phase and group delay at the crossover frequency. The classic second-order analog allpass is a natural choice. 2 Analog Second-Order Allpass Response A second-order analog allpass filter has transfer function H(s) = s 2 0 Q s + 2 0 s 2 + 0 Q s + 2 0 . (1) From the frequency response H(i) = 1 ( 0 ) 2 i 1 Q 0 1 ( 0 ) 2 + i 1 Q 0 we can derive the phase response () 6 H(i) = 2 tan1 1 Q · x 1 x 2 (2) where x = /0. Note that () is monotonically decreasing (when unwrapped) from 0 to 360 . The group delay is then () d d = 2Q 0 · x 2 + 1 (x 1)2(x + 1)2Q2 + x 2 . (3) Examination shows that is strictly positive. For sufficiently large Q the group delay has a peak near 0. 1 3 Design for Prescribed Phase and Group Delay We wish to design a second-order allpass that achieves a prescribed (negative) phase ˆ and group delay ˆ at the crossover frequency ˆ. We need to determine values of the allpass parameters 0, Q that achieve these targets. Equation (2) gives ˆ = 2 tan1 1 Q · x 1 x 2 = tan ˆ 2 = 1 Q · x 1 x 2 (4) where x = ˆ/0, while from equation (3) we have ˆ = 2Q 0 · x 2 + 1 (x 1)2(x + 1)2Q2 + x 2 (5) Using (4) to eliminate Q from (5) yields (after some algebra) ˆˆ sin ˆ = x 2 + 1 x 2 1 . Solving for (positive) x yields x = r k + 1 k 1 where k = ˆ /ˆ sin ˆ. Note that existence of a solution requires |k| > 1; this condition is equivalent to >ˆ |sin ˆ| ˆ which gives a lower bound on the group delay that can be achieved at a given phase angle and frequency. The final design equations can be re-written as follows: k := ˆˆ sin ˆ 0 := ˆ r k 1 k + 1 Q := cot ˆ 2 · 0ˆ ˆ 2 2 0 . (6) 4 Digital Implementation A second-order recursive digital filter (biquad) has the generic transfer function Hd(z) = b0 + b1z 1 + b2z 2 1 + a1z1 + a2z2 . If the filter is an allpass then there is a symmetry of the coefficients such that (b0, b1, b2) = (a2, a1, 1), and the transfer function becomes Hd(z) = a2 + a1z 1 + z 2 1 + a1z1 + a2z2 . (7) To derive a digital implementation of the analog allpass of the previous section, we apply a bilinear transform to the analog transfer function in equation (1). This approach to digital 2 filter design has the advantage that stability is guaranteed stability, though we must take care to compensate for frequency warping. The bilinear transform requires that Hd(z) = H 2 T z 1 z + 1 (8) where T is the sampling period. After some algebra, matching coefficients on the left- and righthand sides of equation (8) yields a1 = 2Q(p 2 1) Q(p 2 + 1) + p a2 = Q(p 2 + 1) p Q(p 2 + 1) + p (9) where p = 0T /2. The bilinear transform causes frequency warping, such that the response of the analog filter (magnitude and phase) at frequency a occurs at frequency d for our digital filter, where a = 2 T tan d T 2 d = 2 T tan1 a T 2 . (10) Although a d to a very good approximation at low frequencies, as we approach the Nyquist frequency the warping gets stronger. To compensate for this we need to pre-warp the crossover frequency, replacing ˆ with 2 T tan ˆ T 2 in the design equations (6) so that our digital filter achieves the target phase response at ˆ. Since frequency warping also changes the group delay of the filter, we need to pre-warp the value of the target group delay ˆ as well. Using subscripts a and d for quantities relating to our analog and digital filters, respectively, we have a da(a) da = da(a) dd dd da = dd(d) dd dd da = d dd da = d da dd 1 and using equation (10) then gives a = d cos2 d T 2 . Thus we need to replace ˆ with ˆ cos2 ˆ T 2 in the design equations (9) so that our digital filter achieves the target group delay ˆ at ˆ. After some simplifications (and dropping the hats on the target parameters , , ) the final design equations for our digital allpass can be written ˆ := 2 T tan T 2 k := T · sin(T) sin 0 := ˆ r k 1 k + 1 Q := cot 2 · 0ˆ ˆ 2 2 0 p := 0T 2 a1 := 2Q(p 2 1) Q(p 2 + 1) + p a2 := Q(p 2 + 1) p Q(p 2 + 1) + p The design is feasible provided |k| > 1, which is equivalent to > T sin(T) |sin |. 3
