Hello All, Im designing and audio equalizer in Simulink. I have 15 FDATool blocks for filters with dbGain blocks after them for the gains. My filters are IIR filters designed using the butterworth design method. The problem is that in the passband of my filters the phase is not perfectly linear. Could someone help instruct me on how to use matlab to design an all pass filter to linearize the phase in these filters? Thank you, Dan

# Cascade All Pass Filters

Started by ●May 10, 2009

Posted by ●May 10, 2009

Dan Brateris wrote:> Hello All, > > Im designing and audio equalizer in Simulink. I have 15 FDATool blocks > for filters with dbGain blocks after them for the gains. My filters > are IIR filters designed using the butterworth design method. The > problem is that in the passband of my filters the phase is not > perfectly linear. Could someone help instruct me on how to use matlab > to design an all pass filter to linearize the phase in these filters?First of all, ask yourself if you need linear phase. (If you weren't aware that Butterworth filters don't exhibit linear phase, you are now that I informed you. In fact, no IIR filters exhibit linear phase.) Second, determine whether the combination of a nonlinear-phase filter and an all-pass to approximately correct the phase is more cumbersome than an FIR filter that inherently has linear phase. In general, all-pass filters are useful for correcting phase errors that are not under the designer's control. When possible, do it right and avoid correction. Jerry P.S. Many practitioners believe that linear-phase filters don't sound very good. The issue is pre-echo. http://en.wikipedia.org/wiki/Pre-echo -- Engineering is the art of making what you want from things you can get. �����������������������������������������������������������������������

Posted by ●May 10, 2009

On Sun, 10 May 2009 21:06:58 -0400, Jerry Avins wrote:> Dan Brateris wrote: >> Hello All, >> >> Im designing and audio equalizer in Simulink. I have 15 FDATool blocks >> for filters with dbGain blocks after them for the gains. My filters >> are IIR filters designed using the butterworth design method. The >> problem is that in the passband of my filters the phase is not >> perfectly linear. Could someone help instruct me on how to use matlab >> to design an all pass filter to linearize the phase in these filters? > > First of all, ask yourself if you need linear phase. (If you weren't > aware that Butterworth filters don't exhibit linear phase, you are now > that I informed you. In fact, no IIR filters exhibit linear phase.) > > Second, determine whether the combination of a nonlinear-phase filter > and an all-pass to approximately correct the phase is more cumbersome > than an FIR filter that inherently has linear phase. In general, > all-pass filters are useful for correcting phase errors that are not > under the designer's control. When possible, do it right and avoid > correction.No _stable_ IIR filters exhibit linear phase. If you're willing to discard that one trivial requirement (or causality, either one) then you can have a linear IIR filter. (Sorry, your answer couldn't be improved upon so I thought I'd get out the rattle-can of Theory and tag it). -- http://www.wescottdesign.com

Posted by ●May 11, 2009

On May 10, 6:06�pm, Jerry Avins <j...@ieee.org> wrote:> Dan Brateris wrote: > > Hello All, > > > Im designing and audio equalizer in Simulink. I have 15 FDATool blocks > > for filters with dbGain blocks after them for the gains.�My filters> > are IIR filters designed using the butterworth design method. The > > problem is that in the passband of my filters the phase is not > > perfectly linear. �Could someone help instruct me on howto use matlab> > to design an all pass filter to linearize the phase in these filters? > > First of all, ask yourself if you need linear phase. (If you weren't > aware that Butterworth filters don't exhibit linear phase, you are now > that I informed you. In fact, no IIR filters exhibit linear phase.) > > Second, determine whether the combination of a nonlinear-phase filter > and an all-pass to approximately correct the phase is more cumbersome > than an FIR filter that inherently has linear phase. In general, > all-pass filters are useful for correcting phase errors that are not > under the designer's control. When possible, do it right and avoid > correction. > > Jerry > > P.S. Many practitioners believe that linear-phase filters don't sound > very good. The issue is pre-echo.http://en.wikipedia.org/wiki/Pre-echo > -- > Engineering is the art of making what you want from things you can get. >����������������������������������������������������������������������� You can have approx linear phase with a Bessel filter and phase equalisation. There was life before digital! Hardy

Posted by ●May 11, 2009

"Jerry Avins" <jya@ieee.org> wrote in message news:TSKNl.53398$HZ1.29769@newsfe15.iad...> > P.S. Many practitioners believe that linear-phase filters don't sound very > good. The issue is pre-echo. http://en.wikipedia.org/wiki/Pre-echoThat's interesting. I guess that as the ear doesn't measure phase per se, then the time shift of things with strong attack, like percussion instruments are the things to worry about. Although I noticed your qualifier 'many'! Symon.

Posted by ●May 11, 2009

On Sun, 10 May 2009 22:06:30 -0500, Tim Wescott <tim@seemywebsite.com> wrote:>> Dan Brateris wrote: >>> Hello All, >>> >>> Im designing and audio equalizer in Simulink. I have 15 FDATool blocks >>> for filters with dbGain blocks after them for the gains. My filters >>> are IIR filters designed using the butterworth design method. The >>> problem is that in the passband of my filters the phase is not >>> perfectly linear. Could someone help instruct me on how to use matlab >>> to design an all pass filter to linearize the phase in these filters? >> >No _stable_ IIR filters exhibit linear phase. If you're willing to >discard that one trivial requirement (or causality, either one) then you >can have a linear IIR filter. > >(... I thought I'd get out the rattle-can of Theory and tag it).Good answer! Thanks for a morning chuckle, Tim! Causality is just a nuisance and stability is overrated. To partially answer the OP: "Modern Filter Theory and Design", Gabor Temes and Sanjit Mitra; section 2.2 "LINEAR PHASE FUNCTIONS", subsection "Equal-Ripple Group-Delay Approximation" -- might get you started. Greg

Posted by ●May 11, 2009

HardySpicer wrote:> On May 10, 6:06 pm, Jerry Avins <j...@ieee.org> wrote: >> Dan Brateris wrote: >>> Hello All, >>> Im designing and audio equalizer in Simulink. I have 15 FDATool blocks >>> for filters with dbGain blocks after them for the gains. My filters >>> are IIR filters designed using the butterworth design method. The >>> problem is that in the passband of my filters the phase is not >>> perfectly linear. Could someone help instruct me on how to use matlab >>> to design an all pass filter to linearize the phase in these filters? >> First of all, ask yourself if you need linear phase. (If you weren't >> aware that Butterworth filters don't exhibit linear phase, you are now >> that I informed you. In fact, no IIR filters exhibit linear phase.) >> >> Second, determine whether the combination of a nonlinear-phase filter >> and an all-pass to approximately correct the phase is more cumbersome >> than an FIR filter that inherently has linear phase. In general, >> all-pass filters are useful for correcting phase errors that are not >> under the designer's control. When possible, do it right and avoid >> correction. >> >> Jerry >> >> P.S. Many practitioners believe that linear-phase filters don't sound >> very good. The issue is pre-echo.http://en.wikipedia.org/wiki/Pre-echo >> -- >> Engineering is the art of making what you want from things you can get. >>�����������������������������������������������������������������������> > You can have approx linear phase with a Bessel filter and phase > equalisation. > There was life before digital!Of course there was. It was my profession for many years. Minimum-phase filters often sound better in audio and almost always work better in servos than linear phase. Audio preemphasis is defined in terms of time constants. The corresponding deemphasis filters best have complementary phase responses. Linkwitz-Reilly crossovers work very well. Linear-phase crossovers with the same amplitude response perform poorly. I'm sure you can think of many other examples where linear phase is no help at all. Jerry -- Engineering is the art of making what you want from things you can get. �����������������������������������������������������������������������

Posted by ●May 11, 2009

On May 10, 11:06�pm, Tim Wescott <t...@seemywebsite.com> wrote:> On Sun, 10 May 2009 21:06:58 -0400, Jerry Avins wrote: > > Dan Brateris wrote: > >> Hello All, > > >> Im designing and audio equalizer in Simulink. I have 15 FDAToolblocks> >> for filters with dbGain blocks after them for the gains.�My filters> >> are IIR filters designed using the butterworth design method. The > >> problem is that in the passband of my filters the phase is not > >> perfectly linear. �Could someone help instruct me onhow to use matlab> >> to design an all pass filter to linearize the phase in these filters? > > > First of all, ask yourself if you need linear phase. (If you weren't > > aware that Butterworth filters don't exhibit linear phase, you are now > > that I informed you. In fact, no IIR filters exhibit linear phase.) > > > Second, determine whether the combination of a nonlinear-phase filter > > and an all-pass to approximately correct the phase is more cumbersome > > than an FIR filter that inherently has linear phase. In general, > > all-pass filters are useful for correcting phase errors that are not > > under the designer's control. When possible, do it right and avoid > > correction. > > No _stable_ IIR filters exhibit linear phase. �If you'rewilling to> discard that one trivial requirement (or causality, either one) then you > can have a linear IIR filter. > > (Sorry, your answer couldn't be improved upon so I thought I'd get out > the rattle-can of Theory and tag it). > > --http://www.wescottdesign.comIn Fred J Harris's book "Multirate Signal Processing for Communication Systems" he discusses The use of allpass filter in multirate filter banks to produce filters with nearly linear phase. In this case the allpass filters also provide the main filter response (i.e. lowpass, bandpass etc) as well as the near phase linearity. Harris's design procedure produces equiripple stopband behaviour. Cheers, David

Posted by ●May 11, 2009

>HardySpicer wrote: >> On May 10, 6:06 pm, Jerry Avins <j...@ieee.org> wrote: >>> Dan Brateris wrote: >>>> Hello All, >>>> Im designing and audio equalizer in Simulink. I have 15 FDAToolblocks>>>> for filters with dbGain blocks after them for the gains. Myfilters>>>> are IIR filters designed using the butterworth design method. The >>>> problem is that in the passband of my filters the phase is not >>>> perfectly linear. Could someone help instruct me on how to usematlab>>>> to design an all pass filter to linearize the phase in thesefilters?>>> First of all, ask yourself if you need linear phase. (If you weren't >>> aware that Butterworth filters don't exhibit linear phase, you arenow>>> that I informed you. In fact, no IIR filters exhibit linear phase.) >>> >>> Second, determine whether the combination of a nonlinear-phase filter >>> and an all-pass to approximately correct the phase is more cumbersome >>> than an FIR filter that inherently has linear phase. In general, >>> all-pass filters are useful for correcting phase errors that are not >>> under the designer's control. When possible, do it right and avoid >>> correction. >>> >>> Jerry >>> >>> P.S. Many practitioners believe that linear-phase filters don't sound >>> very good. The issue ispre-echo.http://en.wikipedia.org/wiki/Pre-echo>>> -- >>> Engineering is the art of making what you want from things you canget.>>>�����������������������������������������������������������������������>> >> You can have approx linear phase with a Bessel filter and phase >> equalisation. >> There was life before digital! > >Of course there was. It was my profession for many years. Minimum-phase >filters often sound better in audio and almost always work better in >servos than linear phase. Audio preemphasis is defined in terms of time >constants. The corresponding deemphasis filters best have complementary >phase responses. Linkwitz-Reilly crossovers work very well. Linear-phase>crossovers with the same amplitude response perform poorly. I'm sure you>can think of many other examples where linear phase is no help at all.I've heard the arguments for minimum phase vs linear phase for audio filtering before because of the pre-ring, but I'm interested in why linear phase would not be ideal for a cross-over. It seams that the cross-over could be complementary for the high / low pass sections and cancel out. Theoretically it sounds good, but is a problem of the loudspeaker performing this way in reality? Jacob> >Jerry >-- >Engineering is the art of making what you want from things you can get. >����������������������������������������������������������������������� >

Posted by ●May 11, 2009

On Mon, 11 May 2009 13:18:26 -0500, "foxcob" <jacob.thefox@gmail.com> wrote:>I've heard the arguments for minimum phase vs linear phase for audio >filtering before because of the pre-ring, but I'm interested in why linear >phase would not be ideal for a cross-over. It seams that the cross-over >could be complementary for the high / low pass sections and cancel out. >Theoretically it sounds good, but is a problem of the loudspeaker >performing this way in reality?Yes, it's a problem in reality. Consider that the lowpass and highpass sections of perfect reconstruction crossovers have frequency responses that sum to unity magnitude and impulse responses that sum to a (delayed) impulse. This means that the pre-ring (and post-ring) of the highpass function is out-of-phase with the pre-ring (and post-ring) of the lowpass function. If the outputs are summed arithmetically or electrically, the ring cancels perfectly. But in reality the outputs are summed acoustically. This means that there will be some locus of points in space where they cancel perfectly (or there would be if the transducers were identical), but at every other point in space they will not. Greg

Posted by ●May 12, 2009

On Mon, 11 May 2009 17:29:50 -0500, "foxcob" <jacob.thefox@gmail.com> wrote:>That is what I suspected. Thanks.You're welcome. Some relevant info here: http://www.aes.org/e-lib/browse.cfm?elib=8170 Available directly from me; just ask. Greg

Posted by ●May 11, 2009

>On Mon, 11 May 2009 13:18:26 -0500, "foxcob"<jacob.thefox@gmail.com>>wrote: > > >>I've heard the arguments for minimum phase vs linear phase for audio >>filtering before because of the pre-ring, but I'm interested in whylinear>>phase would not be ideal for a cross-over. It seams that thecross-over>>could be complementary for the high / low pass sections and cancel out.>>Theoretically it sounds good, but is a problem of the loudspeaker >>performing this way in reality? > >Yes, it's a problem in reality. > >Consider that the lowpass and highpass sections of perfect >reconstruction crossovers have frequency responses that sum to unity >magnitude and impulse responses that sum to a (delayed) impulse. This >means that the pre-ring (and post-ring) of the highpass function is >out-of-phase with the pre-ring (and post-ring) of the lowpass >function. If the outputs are summed arithmetically or electrically, >the ring cancels perfectly. But in reality the outputs are summed >acoustically. This means that there will be some locus of points in >space where they cancel perfectly (or there would be if the >transducers were identical), but at every other point in space they >will not. > >Greg >That is what I suspected. Thanks. Jacob

Posted by ●May 11, 2009

foxcob wrote: ...> I've heard the arguments for minimum phase vs linear phase for audio > filtering before because of the pre-ring, but I'm interested in why linear > phase would not be ideal for a cross-over. It seams that the cross-over > could be complementary for the high / low pass sections and cancel out. > Theoretically it sounds good, but is a problem of the loudspeaker > performing this way in reality?Crossover design is tricky. The speakers for different ranges are physically separated, forming a directional array in the crossover region. In some installations, the woofer is at the front of the cabinet, while the driver for the horn tweeter can be some distance behind. There are interesting discussions of crossover networks at http://www.frazierspeakers.com/download/cross.pdf and particularly http://www.rane.com/note160.html. Avoiding interference effects is just as important as maintaining good stereo effect in different parts of the room. Jerry -- Engineering is the art of making what you want from things you can get.

Posted by ●May 11, 2009

On Mon, 11 May 2009 13:18:26 -0500, "foxcob" <jacob.thefox@gmail.com> wrote:>I've heard the arguments for minimum phase vs linear phase for audio >filtering before because of the pre-ring, but I'm interested in why linear >phase would not be ideal for a cross-over. It seams that the cross-over >could be complementary for the high / low pass sections and cancel out. >Theoretically it sounds good, but is a problem of the loudspeaker >performing this way in reality?Yes, it's a problem in reality. Consider that the lowpass and highpass sections of perfect reconstruction crossovers have frequency responses that sum to unity magnitude and impulse responses that sum to a (delayed) impulse. This means that the pre-ring (and post-ring) of the highpass function is out-of-phase with the pre-ring (and post-ring) of the lowpass function. If the outputs are summed arithmetically or electrically, the ring cancels perfectly. But in reality the outputs are summed acoustically. This means that there will be some locus of points in space where they cancel perfectly (or there would be if the transducers were identical), but at every other point in space they will not. Greg

Posted by ●May 11, 2009

>HardySpicer wrote: >> On May 10, 6:06 pm, Jerry Avins <j...@ieee.org> wrote: >>> Dan Brateris wrote: >>>> Hello All, >>>> Im designing and audio equalizer in Simulink. I have 15 FDAToolblocks>>>> for filters with dbGain blocks after them for the gains. Myfilters>>>> are IIR filters designed using the butterworth design method. The >>>> problem is that in the passband of my filters the phase is not >>>> perfectly linear. Could someone help instruct me on how to usematlab>>>> to design an all pass filter to linearize the phase in thesefilters?>>> First of all, ask yourself if you need linear phase. (If you weren't >>> aware that Butterworth filters don't exhibit linear phase, you arenow>>> that I informed you. In fact, no IIR filters exhibit linear phase.) >>> >>> Second, determine whether the combination of a nonlinear-phase filter >>> and an all-pass to approximately correct the phase is more cumbersome >>> than an FIR filter that inherently has linear phase. In general, >>> all-pass filters are useful for correcting phase errors that are not >>> under the designer's control. When possible, do it right and avoid >>> correction. >>> >>> Jerry >>> >>> P.S. Many practitioners believe that linear-phase filters don't sound >>> very good. The issue ispre-echo.http://en.wikipedia.org/wiki/Pre-echo>>> -- >>> Engineering is the art of making what you want from things you canget.>>>�����������������������������������������������������������������������>> >> You can have approx linear phase with a Bessel filter and phase >> equalisation. >> There was life before digital! > >Of course there was. It was my profession for many years. Minimum-phase >filters often sound better in audio and almost always work better in >servos than linear phase. Audio preemphasis is defined in terms of time >constants. The corresponding deemphasis filters best have complementary >phase responses. Linkwitz-Reilly crossovers work very well. Linear-phase>crossovers with the same amplitude response perform poorly. I'm sure you>can think of many other examples where linear phase is no help at all.I've heard the arguments for minimum phase vs linear phase for audio filtering before because of the pre-ring, but I'm interested in why linear phase would not be ideal for a cross-over. It seams that the cross-over could be complementary for the high / low pass sections and cancel out. Theoretically it sounds good, but is a problem of the loudspeaker performing this way in reality? Jacob> >Jerry >-- >Engineering is the art of making what you want from things you can get. >����������������������������������������������������������������������� >

Posted by ●May 11, 2009

On May 10, 11:06�pm, Tim Wescott <t...@seemywebsite.com> wrote:> On Sun, 10 May 2009 21:06:58 -0400, Jerry Avins wrote: > > Dan Brateris wrote: > >> Hello All, > > >> Im designing and audio equalizer in Simulink. I have 15 FDAToolblocks> >> for filters with dbGain blocks after them for the gains.�My filters> >> are IIR filters designed using the butterworth design method. The > >> problem is that in the passband of my filters the phase is not > >> perfectly linear. �Could someone help instruct me onhow to use matlab> >> to design an all pass filter to linearize the phase in these filters? > > > First of all, ask yourself if you need linear phase. (If you weren't > > aware that Butterworth filters don't exhibit linear phase, you are now > > that I informed you. In fact, no IIR filters exhibit linear phase.) > > > Second, determine whether the combination of a nonlinear-phase filter > > and an all-pass to approximately correct the phase is more cumbersome > > than an FIR filter that inherently has linear phase. In general, > > all-pass filters are useful for correcting phase errors that are not > > under the designer's control. When possible, do it right and avoid > > correction. > > No _stable_ IIR filters exhibit linear phase. �If you'rewilling to> discard that one trivial requirement (or causality, either one) then you > can have a linear IIR filter. > > (Sorry, your answer couldn't be improved upon so I thought I'd get out > the rattle-can of Theory and tag it). > > --http://www.wescottdesign.comIn Fred J Harris's book "Multirate Signal Processing for Communication Systems" he discusses The use of allpass filter in multirate filter banks to produce filters with nearly linear phase. In this case the allpass filters also provide the main filter response (i.e. lowpass, bandpass etc) as well as the near phase linearity. Harris's design procedure produces equiripple stopband behaviour. Cheers, David

Posted by ●May 11, 2009

HardySpicer wrote:> On May 10, 6:06 pm, Jerry Avins <j...@ieee.org> wrote: >> Dan Brateris wrote: >>> Hello All, >>> Im designing and audio equalizer in Simulink. I have 15 FDATool blocks >>> for filters with dbGain blocks after them for the gains. My filters >>> are IIR filters designed using the butterworth design method. The >>> problem is that in the passband of my filters the phase is not >>> perfectly linear. Could someone help instruct me on how to use matlab >>> to design an all pass filter to linearize the phase in these filters? >> First of all, ask yourself if you need linear phase. (If you weren't >> aware that Butterworth filters don't exhibit linear phase, you are now >> that I informed you. In fact, no IIR filters exhibit linear phase.) >> >> Second, determine whether the combination of a nonlinear-phase filter >> and an all-pass to approximately correct the phase is more cumbersome >> than an FIR filter that inherently has linear phase. In general, >> all-pass filters are useful for correcting phase errors that are not >> under the designer's control. When possible, do it right and avoid >> correction. >> >> Jerry >> >> P.S. Many practitioners believe that linear-phase filters don't sound >> very good. The issue is pre-echo.http://en.wikipedia.org/wiki/Pre-echo >> -- >> Engineering is the art of making what you want from things you can get. >>�����������������������������������������������������������������������> > You can have approx linear phase with a Bessel filter and phase > equalisation. > There was life before digital!Of course there was. It was my profession for many years. Minimum-phase filters often sound better in audio and almost always work better in servos than linear phase. Audio preemphasis is defined in terms of time constants. The corresponding deemphasis filters best have complementary phase responses. Linkwitz-Reilly crossovers work very well. Linear-phase crossovers with the same amplitude response perform poorly. I'm sure you can think of many other examples where linear phase is no help at all. Jerry -- Engineering is the art of making what you want from things you can get. �����������������������������������������������������������������������

Posted by ●May 11, 2009

On Sun, 10 May 2009 22:06:30 -0500, Tim Wescott <tim@seemywebsite.com> wrote:>> Dan Brateris wrote: >>> Hello All, >>> >>> Im designing and audio equalizer in Simulink. I have 15 FDATool blocks >>> for filters with dbGain blocks after them for the gains. My filters >>> are IIR filters designed using the butterworth design method. The >>> problem is that in the passband of my filters the phase is not >>> perfectly linear. Could someone help instruct me on how to use matlab >>> to design an all pass filter to linearize the phase in these filters? >> >No _stable_ IIR filters exhibit linear phase. If you're willing to >discard that one trivial requirement (or causality, either one) then you >can have a linear IIR filter. > >(... I thought I'd get out the rattle-can of Theory and tag it).Good answer! Thanks for a morning chuckle, Tim! Causality is just a nuisance and stability is overrated. To partially answer the OP: "Modern Filter Theory and Design", Gabor Temes and Sanjit Mitra; section 2.2 "LINEAR PHASE FUNCTIONS", subsection "Equal-Ripple Group-Delay Approximation" -- might get you started. Greg

Posted by ●May 11, 2009

"Jerry Avins" <jya@ieee.org> wrote in message news:TSKNl.53398$HZ1.29769@newsfe15.iad...> > P.S. Many practitioners believe that linear-phase filters don't sound very > good. The issue is pre-echo. http://en.wikipedia.org/wiki/Pre-echoThat's interesting. I guess that as the ear doesn't measure phase per se, then the time shift of things with strong attack, like percussion instruments are the things to worry about. Although I noticed your qualifier 'many'! Symon.

Posted by ●May 11, 2009

On May 10, 6:06�pm, Jerry Avins <j...@ieee.org> wrote:> Dan Brateris wrote: > > Hello All, > > > Im designing and audio equalizer in Simulink. I have 15 FDATool blocks > > for filters with dbGain blocks after them for the gains.�My filters> > are IIR filters designed using the butterworth design method. The > > problem is that in the passband of my filters the phase is not > > perfectly linear. �Could someone help instruct me on howto use matlab> > to design an all pass filter to linearize the phase in these filters? > > First of all, ask yourself if you need linear phase. (If you weren't > aware that Butterworth filters don't exhibit linear phase, you are now > that I informed you. In fact, no IIR filters exhibit linear phase.) > > Second, determine whether the combination of a nonlinear-phase filter > and an all-pass to approximately correct the phase is more cumbersome > than an FIR filter that inherently has linear phase. In general, > all-pass filters are useful for correcting phase errors that are not > under the designer's control. When possible, do it right and avoid > correction. > > Jerry > > P.S. Many practitioners believe that linear-phase filters don't sound > very good. The issue is pre-echo.http://en.wikipedia.org/wiki/Pre-echo > -- > Engineering is the art of making what you want from things you can get. >����������������������������������������������������������������������� You can have approx linear phase with a Bessel filter and phase equalisation. There was life before digital! Hardy