Hi all, Is there a way to implement 0 phase IIR in real time? Filtfilt in matlab could implement,but it is non real time. Now I want to let a signal through the PEQ filter without phase delay,I've thought a lot of ways, but no one can achieve real time. Please help me. Tks Alan
How to implement 0 phase IIR in real time?
Started by ●September 2, 2011
Reply by ●September 2, 20112011-09-02
On 9/2/2011 7:27 AM, zaitax wrote:> Hi all, > > Is there a way to implement 0 phase IIR in real time? Filtfilt in matlab > could implement,but it is non real time. > Now I want to let a signal through the PEQ filter without phase delay,I've > thought a lot of ways, but no one can achieve real time. > Please help me. > > Tks > Alan > >Not really, you can implement a filtfilt type algorithm in real-time but it will require block processing. The block processing will add latency, i.e not 0 phase. But you can get linear phase out of the IIR filter. .chris
Reply by ●September 2, 20112011-09-02
On Sep 2, 8:51�am, Christopher Felton <nos...@nowhere.com> wrote:> On 9/2/2011 7:27 AM, zaitax wrote:> Hi all, > > > Is there a way to implement 0 phase IIR in real time? Filtfilt in matlab > > could implement,but it is non real time. > > Now I want to let a signal through the PEQ filter without phase delay,I've > > thought a lot of ways, but no one can achieve real time. > > Please help me. > > > Tks > > Alan > > Not really, you can implement a filtfilt type algorithm in real-time but > it will require block processing. �The block processing will add > latency, i.e not 0 phase. �But you can get linear phase out of the IIR > filter. > > .chrisLook at AES preprint #4506. It's basically an implementation of the filtfilt algorithm mentioned above, with some method of stitching together the finite-length blocks without any artifacts. Still have the block-delay, can't get around this. Bob Bob
Reply by ●September 2, 20112011-09-02
On 9/2/11 9:29 AM, Robert Adams wrote:> On Sep 2, 8:51 am, Christopher Felton<nos...@nowhere.com> wrote: >> On 9/2/2011 7:27 AM, zaitax wrote:> Hi all, >> >>> Is there a way to implement 0 phase IIR in real time? Filtfilt in matlab >>> could implement,but it is non real time. >>> Now I want to let a signal through the PEQ filter without phase delay,I've >>> thought a lot of ways, but no one can achieve real time. >>> Please help me. >> >> >> Not really, you can implement a filtfilt type algorithm in real-time but >> it will require block processing. The block processing will add >> latency, i.e not 0 phase. But you can get linear phase out of the IIR >> filter. >> > > Look at AES preprint #4506. It's basically an implementation of the > filtfilt algorithm mentioned above, with some method of stitching > together the finite-length blocks without any artifacts. Still have > the block-delay, can't get around this. >one thing, to do it strictly without artifacts (when switching the time-reversed blocks), the filters shouldn't be just an IIR, but it should be a *truncated* IIR (TIIR) which turns out to be FIR, but done with recursive signal paths like an IIR. essentially, Alan, it's doing filtfilt on blocks and overlap-adding. the length of the block is twice the length of the TIIR, if i recall correctly. it's enough to "charge up" the filter plus what you need to empty it out. after time-reversing, the "empty out" portion of the newer block (which now comes first, because you reversed it) is overlapped with the "charge up" portion of the previous block (which is the last part of the block after time reversing). look up truncated IIR filters and papers by Avery Wang and Julius Smith. -- r b-j rbj@audioimagination.com "Imagination is more important than knowledge."
Reply by ●September 2, 20112011-09-02
On Fri, 02 Sep 2011 07:27:18 -0500, zaitax wrote:> Hi all, > > Is there a way to implement 0 phase IIR in real time? Filtfilt in matlab > could implement,but it is non real time. Now I want to let a signal > through the PEQ filter without phase delay,I've thought a lot of ways, > but no one can achieve real time. Please help me.Step 1: Move to a different universe. Step 2: Enjoy! (No, you can't make a zero-delay filter. You can't make a zero delay filter because that implies having portions of it see into the future. If you could do _that_, you'd be making tons of money on the stock market, not messing around with DSP.) -- www.wescottdesign.com
Reply by ●September 2, 20112011-09-02
On 9/2/2011 8:46 AM, Tim Wescott wrote:> On Fri, 02 Sep 2011 07:27:18 -0500, zaitax wrote: > >> Hi all, >> >> Is there a way to implement 0 phase IIR in real time? Filtfilt in matlab >> could implement,but it is non real time. Now I want to let a signal >> through the PEQ filter without phase delay,I've thought a lot of ways, >> but no one can achieve real time. Please help me. > > Step 1: Move to a different universe. > > Step 2: Enjoy! > > (No, you can't make a zero-delay filter. You can't make a zero delay > filter because that implies having portions of it see into the future. > If you could do _that_, you'd be making tons of money on the stock > market, not messing around with DSP.) >Tim, He didn't say zero delay. He said zero phase. .. and then he mentioned "phase delay" whatever that is. :-) Well, maybe that means something to him that's different from what we might assume. zaitax, Depending on what you're really trying to accomplish I would suggest something like this: 1) if you mean zero delay then Tim is right. 2) if you mean zero phase then just tweak your clock (i.e. time reference) 3) if you mean zero phase *difference* over frequency then use a linear phase FIR filter perhaps. After all this would be a fixed delay and a fixed delay is the only realizable thing you can get. 4) if you don't have to operate in real time then you might use a linear phase, centered at t=0 (whatever that means) FIR filter so there is "zero delay" in the context of that filter. This is simply changing your time reference as in (2) above. Fred
Reply by ●September 2, 20112011-09-02
top posting here. (don't you just hate top posters?) anyway, guys, in the context of filtfilt(), he means 0 phase shift relative to the constant delay you will need to implement it. i'm sure, when you mix zero-phase, IIR, and filtfilt(), the OP means this: S. R. Powell & P. M. Chau, "A Technique for Realizing Linear Phase IIR Filters", IEEE ASSP-39, no.11, pp. 2425-2435, (Nov. 1991). S. A. Azizi, "Performance Analysis of Linear Phase Audio Filters Based on the Zero Phase Filtering Concept", 103rd AES Convention (Sept. 1997), AES preprint no. 4535. and, if you toss in the truncated IIR technique so that, to the degree of numerical accuracy your word size affords, there are *no* artifacts when switching blocks, doing it the Powell/Chau/Azizi method. theoretically no problem of lobbing off tails. i dunno what the AES preprint #4506 that Bob was referring to (can you tell us, Bob, like author and title?) the preprint i had thought he was referring to was the Azizi preprint. anyway, if you combine the Powell/Chau technique with the TIIR technique that i first saw came from Avery Wang and Julius Smith: https://ccrma.stanford.edu/~jos/pdf/tiir.pdf if you do that, you can use an IIR design (keep every frequency spec the same, but design the magnitude specs at 1/2 the number of dB originally intended) with this block overlap-add filtfilt thing and if truncated IIRs are used, there should be no click noise resulting from lobbing off a decaying tail. -- r b-j rbj@audioimagination.com "Imagination is more important than knowledge." On 9/2/11 3:41 PM, Fred Marshall wrote:> On 9/2/2011 8:46 AM, Tim Wescott wrote: >> On Fri, 02 Sep 2011 07:27:18 -0500, zaitax wrote: >> >>> >>> Is there a way to implement 0 phase IIR in real time? Filtfilt in matlab >>> could implement,but it is non real time. Now I want to let a signal >>> through the PEQ filter without phase delay,I've thought a lot of ways, >>> but no one can achieve real time. Please help me. >> >> Step 1: Move to a different universe. >> >> Step 2: Enjoy! >> >> (No, you can't make a zero-delay filter. You can't make a zero delay >> filter because that implies having portions of it see into the future. >> If you could do _that_, you'd be making tons of money on the stock >> market, not messing around with DSP.) >> > > He didn't say zero delay. He said zero phase. .. and then he mentioned > "phase delay" whatever that is. :-) > > Well, maybe that means something to him that's different from what we > might assume. > > zaitax, > > Depending on what you're really trying to accomplish I would suggest > something like this: > > 1) if you mean zero delay then Tim is right. > > 2) if you mean zero phase then just tweak your clock (i.e. time reference) > > 3) if you mean zero phase *difference* over frequency then use a linear > phase FIR filter perhaps. After all this would be a fixed delay and a > fixed delay is the only realizable thing you can get. > > 4) if you don't have to operate in real time then you might use a linear > phase, centered at t=0 (whatever that means) FIR filter so there is > "zero delay" in the context of that filter. This is simply changing your > time reference as in (2) above. >
Reply by ●September 3, 20112011-09-03
On 9/2/11 10:46 PM, robert bristow-johnson wrote:> > > i'm sure, when you mix zero-phase, IIR, and filtfilt(),i forgot to add "real-time". if it's about zero-phase, IIR, filtfilt(), *and* real time, it's about this Powell/Chau thing.> > S. R. Powell & P. M. Chau, "A Technique for Realizing Linear Phase IIR > Filters", IEEE ASSP-39, no.11, pp. 2425-2435, (Nov. 1991). > > S. A. Azizi, "Performance Analysis of Linear Phase Audio Filters Based > on the Zero Phase Filtering Concept", 103rd AES Convention (Sept. 1997), > AES preprint no. 4535. >and i just found a .pdf on my mac (that i did, it's really terse) that has the equations for designing truncated IIRs for 1st and 2nd-order IIRs with real coefficients. so, in addition to reading> > https://ccrma.stanford.edu/~jos/pdf/tiir.pdf >if you're really interested in designing a truncated IIR from the coefficients of an existing, untruncated IIR, just drop a line and i'll send you that pdf. -- r b-j rbj@audioimagination.com "Imagination is more important than knowledge."
Reply by ●September 3, 20112011-09-03
>On 9/2/2011 8:46 AM, Tim Wescott wrote: >> On Fri, 02 Sep 2011 07:27:18 -0500, zaitax wrote: >> >>> Hi all, >>> >>> Is there a way to implement 0 phase IIR in real time? Filtfilt inmatlab>>> could implement,but it is non real time. Now I want to let a signal >>> through the PEQ filter without phase delay,I've thought a lot of ways, >>> but no one can achieve real time. Please help me. >> >> Step 1: Move to a different universe. >> >> Step 2: Enjoy! >> >> (No, you can't make a zero-delay filter. You can't make a zero delay >> filter because that implies having portions of it see into the future. >> If you could do _that_, you'd be making tons of money on the stock >> market, not messing around with DSP.) >> > >Tim, > >He didn't say zero delay. He said zero phase. .. and then he mentioned >"phase delay" whatever that is. :-) > >Well, maybe that means something to him that's different from what we >might assume. > >zaitax, > >Depending on what you're really trying to accomplish I would suggest >something like this: > >1) if you mean zero delay then Tim is right. > >2) if you mean zero phase then just tweak your clock (i.e. timereference)> >3) if you mean zero phase *difference* over frequency then use a linear >phase FIR filter perhaps. After all this would be a fixed delay and a >fixed delay is the only realizable thing you can get. > >4) if you don't have to operate in real time then you might use a linear >phase, centered at t=0 (whatever that means) FIR filter so there is >"zero delay" in the context of that filter. This is simply changing >your time reference as in (2) above. > >Fred >Hi all, I am doing in a KTV system, which required through PEQ filter without phase distortion, but the total system delay is required very low, so I want to make a zero delay PEQ. I thought put the PEQ IIR into linear phase FIR, but that would require a lot of order for FIR, the delay will be high. Who can tell me there is another way to reduce delay? In addition, zero phase filter should not be zero delay? If there is a delay, input and output signal phase difference will be not zero. I recently read a paper "Design Method of Digital Filter with Zero Phase Based on All Phase", he said in all phase method to design a zero phase filter, but when I according to his method using MATLAB simulation, gets the linear phase FIR filter, delay of FIR will have a phase difference between input and output, how he got zero phase? I was confused. Tks Alan
Reply by ●September 3, 20112011-09-03
On Sep 3, 5:45�am, "zaitax" <zaitax@n_o_s_p_a_m.qq.com> wrote:> >On 9/2/2011 8:46 AM, Tim Wescott wrote: > >> On Fri, 02 Sep 2011 07:27:18 -0500, zaitax wrote: > > >>> Hi all, > > >>> Is there a way to implement 0 phase IIR in real time? Filtfilt in > matlab > >>> could implement,but it is non real time. Now I want to let a signal > >>> through the PEQ filter without phase delay,I've thought a lot of ways, > >>> but no one can achieve real time. Please help me. > > >> Step 1: �Move to a different universe. > > >> Step 2: �Enjoy! > > >> (No, you can't make a zero-delay filter. �You can't make a zero delay > >> filter because that implies having portions of it see into the future. > >> If you could do _that_, you'd be making tons of money on the stock > >> market, not messing around with DSP.) > > >Tim, > > >He didn't say zero delay. �He said zero phase. .. and then he mentioned > >"phase delay" whatever that is. � :-) > > >Well, maybe that means something to him that's different from what we > >might assume. > > >zaitax, > > >Depending on what you're really trying to accomplish I would suggest > >something like this: > > >1) if you mean zero delay then Tim is right. > > >2) if you mean zero phase then just tweak your clock (i.e. time > reference) > > >3) if you mean zero phase *difference* over frequency then use a linear > >phase FIR filter perhaps. �After all this would be a fixed delay and a > >fixed delay is the only realizable thing you can get. > > >4) if you don't have to operate in real time then you might use a linear > >phase, centered at t=0 (whatever that means) FIR filter so there is > >"zero delay" in the context of that filter. �This is simply changing > >your time reference as in (2) above. > > >Fred > > Hi all, > > I am doing in a KTV system, which required through PEQ filter without phase > distortion, but the total system delay is required very low, so I want to > make a zero delay PEQ. I thought put the PEQ IIR into linear phase FIR, but > that would require a lot of order for FIR, the delay will be high. �Who can > tell me there is another way to reduce delay?Make up your mind about whst you want to do: linear phase or minimum delay? Trade one for the other.> In addition, zero phase filter should not be zero delay? If there is a > delay, input and output signal phase difference will be not zero.Zero phase filters only work in off-line applications. Which is a term to indicate that absulute lag times don't matter.> I recently read a paper "Design Method of Digital Filter with Zero Phase > Based on All Phase", he said in all phase method to design a zero phase > filter, but when I according to his method using MATLAB simulation, gets > the linear phase FIR filter, delay of FIR will have a phase difference > between input and output, how he got zero phase? I was confused.Read up on badic systems theory. Rune






