On May 2, 11:47�am, Greg Berchin <gjberc...@chatter.net.invalid> wrote:> On Thu, 2 May 2013 08:37:00 -0700 (PDT), robert bristow-johnson > > <r...@audioimagination.com> wrote: > >> Years ago I needed to design a FIR Hilbert Transformer for audio. > >> Trying to maintain 90� phase shift near DC was untenable, but > >> allowing a highpass characteristic with a cutoff ~30Hz made the > >> job pretty easy. > > >still a pretty large number of taps. > > About 4K, IIRC, for the coefficient precision that I had. Since I > was using 16K FFTs, it fit nicely. It was a whole lot better than > the >64K taps I would have needed to take it all the way down to > DC. >i curious to how it is even possible to get *all* the way down to DC. H.T. must be odd symmetry (-pi/2 for positive frequency and +pi/2 for negative) and if it's odd symmetry, it must pass through 0 at DC. you can get down to +epsilon and the closer epsilon is to zero the longer the impulse response is. at least that's how i understand it. r b-j
Help with All-Pass Filter Design Method
Started by ●May 2, 2013
Reply by ●May 2, 20132013-05-02
Reply by ●May 2, 20132013-05-02
On May 2, 11:47�am, Greg Berchin <gjberc...@chatter.net.invalid> wrote:> On Thu, 2 May 2013 08:37:00 -0700 (PDT), robert bristow-johnson > > <r...@audioimagination.com> wrote: > >> Years ago I needed to design a FIR Hilbert Transformer for audio. > >> Trying to maintain 90� phase shift near DC was untenable, but > >> allowing a highpass characteristic with a cutoff ~30Hz made the > >> job pretty easy. > > >still a pretty large number of taps. > > About 4K, IIRC, for the coefficient precision that I had. Since I > was using 16K FFTs, it fit nicely. It was a whole lot better than > the >64K taps I would have needed to take it all the way down to > DC. > > GregIn Harris' book on Multirate processing he discusses how to design a filter based on Allpass structures to get an approximately linear phase response. Basic method consists of 2 parellel Allpass structures which are added to produce the overall filter response. I'm not sure if the method could be generalized to arbitrary group responses. Cheers, David
Reply by ●May 2, 20132013-05-02
On Thu, 2 May 2013 10:11:33 -0700 (PDT), robert bristow-johnson <rbj@audioimagination.com> wrote:>i curious to how it is even possible to get *all* the way down to DC. >H.T. must be odd symmetry (-pi/2 for positive frequency and +pi/2 for >negative) and if it's odd symmetry, it must pass through 0 at DC.With infinite precision, it is not possible. But if you look at the impulse response of an ideal Hilbert Transformer (Oppenheim & Schafer show a graph in one of their editions), it is possible with finite precision (truncated in time and quantized in amplitude). The DC response is 1+j0�epsilon, I believe.>you can get down to +epsilon and the closer epsilon is to zero the >longer the impulse response is.That's another way to approximate it.>at least that's how i understand it.You understand correctly. Greg
Reply by ●May 2, 20132013-05-02
On 5/2/2013 9:42 AM, Greg Berchin wrote:> I tried to download the article, but was politely told that "This > content is outside your IEEE member subscription". > > Since this is a digital filter, I'm assuming that trivial sample > delay is not an option (i.e., your desired group delay is either > not an integer number of samples, or is not constant). Would > oversampling such that the delay *is* an integer number of samples > help? > > Otherwise, at the risk of sounding like Rudy Giuliani ("A noun, a > verb, and FDLS"), I'd run it through FDLS to see if it can find a > viable solution for you.It is possible to design to arbitrary magnitude and phase by Parks-McClellan, too; although the result won't necessarily be optimal. IIRC Eric Jacobsen outlined a procedure to do that. Vladimir Vassilevsky DSP and Mixed Signal Designs www.abvolt.com
Reply by ●May 2, 20132013-05-02
>>Years ago I needed to design a FIR Hilbert Transformer for audio. >>Trying to maintain 90� phase shift near DC was untenable, but >>allowing a highpass characteristic with a cutoff ~30Hz made the >>job pretty easy. So I recommend that you compromise on the >>amplitude response in any way available to you. >> >>Greg >> > >Wouldn't maintaining a 90 degree phase shift at DC be impossible? > >In any event, if the only constraint of the filter is the group delay,than>there is no reason why the phase at DC should not be 0. If the groupdelay>is dp(w)/dw, where p is the phase and w is the angular frequency, thanp(w)>= integral from 0 to w of dp(w)/dw with an initial conidition of dp(w)/dw=>0. > >While I'm sure everyone already got that far, I don't see why the ifft >based approach wouldn't work, at least as an inefficient proof of concept >in MATLAB. > >westocl, would you elaborate on the problems you encountered in this >approach? Was the impulse response non-convergent (or really reallylong)>or acausal or something of that nature? Or did the impulse response >generated simply not behave as expected?One reason ive encountered is the peakyness of part of the groupdelay plot that seems to beg for a pole. Another reason is that i do wish that the magnitude response stay at unity, uness i tweak somthing else in the chain to compensate. I understand that maybe I may not be able to match the dealy exactly, but the question then becomes what is the optimum solution... possibly in the LS sense or WLS. Trading off taps for accuracy could be an option. I could post my desired Group Delay if you wanna take a look.
Reply by ●May 2, 20132013-05-02
>On 5/2/2013 10:13 AM, westocl wrote: >>> I tried to download the article, but was politely told that "This >>> content is outside your IEEE member subscription". >>> >>> Since this is a digital filter, I'm assuming that trivial sample >>> delay is not an option (i.e., your desired group delay is either >>> not an integer number of samples, or is not constant). Would >>> oversampling such that the delay *is* an integer number of samples >>> help? >>> >>> Otherwise, at the risk of sounding like Rudy Giuliani ("A noun, a >>> verb, and FDLS"), I'd run it through FDLS to see if it can find a >>> viable solution for you. >>> >>> Greg >> >> My 'desired' group delay is a nasty one, but very specific. Ive playedwith>> some ifft methods to design the filter, but no good so far. > >If FFT doesn't work, then your problem is that you don't have a clue. >As such, no cookbook method is going to help. >Seek for professional assistance or go read textbooks. > >VLV >VLV, it pains me to see whenever you respond. Always something negative or derogatory, doesnt matter the topic.
Reply by ●May 2, 20132013-05-02
On 2.5.13 8:11 , robert bristow-johnson wrote:> On May 2, 11:47 am, Greg Berchin <gjberc...@chatter.net.invalid> > wrote: >> On Thu, 2 May 2013 08:37:00 -0700 (PDT), robert bristow-johnson >> >> <r...@audioimagination.com> wrote: >>>> Years ago I needed to design a FIR Hilbert Transformer for audio. >>>> Trying to maintain 90� phase shift near DC was untenable, but >>>> allowing a highpass characteristic with a cutoff ~30Hz made the >>>> job pretty easy. >> >>> still a pretty large number of taps. >> >> About 4K, IIRC, for the coefficient precision that I had. Since I >> was using 16K FFTs, it fit nicely. It was a whole lot better than >> the >64K taps I would have needed to take it all the way down to >> DC. >> > > i curious to how it is even possible to get *all* the way down to DC. > H.T. must be odd symmetry (-pi/2 for positive frequency and +pi/2 for > negative) and if it's odd symmetry, it must pass through 0 at DC. > > you can get down to +epsilon and the closer epsilon is to zero the > longer the impulse response is. > > at least that's how i understand it. > > r b-jOnly if you are ready to wait forever for the 90 degree delayed copy of the other channel signal. The minimum delay needed for a causal band-limited Hilbert transformer is a quarter cycle at the lowest frequency to pass. -- Tauno Voipio
Reply by ●May 2, 20132013-05-02
>>>Years ago I needed to design a FIR Hilbert Transformer for audio. >>>Trying to maintain 90� phase shift near DC was untenable, but >>>allowing a highpass characteristic with a cutoff ~30Hz made the >>>job pretty easy. So I recommend that you compromise on the >>>amplitude response in any way available to you. >>> >>>Greg >>> >> >>Wouldn't maintaining a 90 degree phase shift at DC be impossible? >> >>In any event, if the only constraint of the filter is the group delay, >than >>there is no reason why the phase at DC should not be 0. If the group >delay >>is dp(w)/dw, where p is the phase and w is the angular frequency, than >p(w) >>= integral from 0 to w of dp(w)/dw with an initial conidition ofdp(w)/dw>= >>0. >> >>While I'm sure everyone already got that far, I don't see why the ifft >>based approach wouldn't work, at least as an inefficient proof ofconcept>>in MATLAB. >> >>westocl, would you elaborate on the problems you encountered in this >>approach? Was the impulse response non-convergent (or really really >long) >>or acausal or something of that nature? Or did the impulse response >>generated simply not behave as expected? > >One reason ive encountered is the peakyness of part of the groupdelayplot>that seems to beg for a pole. Another reason is that i do wish that the >magnitude response stay at unity, uness i tweak somthing else in thechain>to compensate. >I could certainly see the logic behind that kind of choice, but using recursive terms wouldn't be a necessity if you simply want to get an FIR with the correct response to work. I can't think of any reason why your source spectrum could not maintain unity magnitude for generation of the impulse response. However, limiting the number of taps in your FIR filter could change the actual magnitude response. If you feel like you have to change the magnitude of the source spectrum for any reason, that could be a source of confusion.>I understand that maybe I may not be able to match the dealy exactly, but >the question then becomes what is the optimum solution... possibly in the >LS sense or WLS. Trading off taps for accuracy could be an option. > >I could post my desired Group Delay if you wanna take a look. >Sure, I'd be happy to take a look at it and be as helpful as I can be.
Reply by ●May 2, 20132013-05-02
I have had good luck with manually playing with allpass filters to get a rough starting pont, and then use a non-linear optimizer. Matlab has one called lsnonlin I think, but it's in a toolbox that many people don't have. Make sure it is really group delay you are trying to match and not phase. Since phase is the integral of group delay, if you only match the group delay over a specific frequency range, then you will match the shape of the phase over that range to the original system, but there will be some random phase offset. I fell into this trap once before. Bob
Reply by ●May 2, 20132013-05-02
>>>>Years ago I needed to design a FIR Hilbert Transformer for audio. >>>>Trying to maintain 90� phase shift near DC was untenable, but >>>>allowing a highpass characteristic with a cutoff ~30Hz made the >>>>job pretty easy. So I recommend that you compromise on the >>>>amplitude response in any way available to you. >>>> >>>>Greg >>>> >>> >>>Wouldn't maintaining a 90 degree phase shift at DC be impossible? >>> >>>In any event, if the only constraint of the filter is the group delay, >>than >>>there is no reason why the phase at DC should not be 0. If the group >>delay >>>is dp(w)/dw, where p is the phase and w is the angular frequency, than >>p(w) >>>= integral from 0 to w of dp(w)/dw with an initial conidition of >dp(w)/dw >>= >>>0. >>> >>>While I'm sure everyone already got that far, I don't see why the ifft >>>based approach wouldn't work, at least as an inefficient proof of >concept >>>in MATLAB. >>> >>>westocl, would you elaborate on the problems you encountered in this >>>approach? Was the impulse response non-convergent (or really really >>long) >>>or acausal or something of that nature? Or did the impulse response >>>generated simply not behave as expected? >> >>One reason ive encountered is the peakyness of part of the groupdelay >plot >>that seems to beg for a pole. Another reason is that i do wish that the >>magnitude response stay at unity, uness i tweak somthing else in the >chain >>to compensate. >> > >I could certainly see the logic behind that kind of choice, but using >recursive terms wouldn't be a necessity if you simply want to get an FIR >with the correct response to work. > >I can't think of any reason why your source spectrum could not maintain >unity magnitude for generation of the impulse response. However,limiting>the number of taps in your FIR filter could change the actual magnitude >response. If you feel like you have to change the magnitude of thesource>spectrum for any reason, that could be a source of confusion. > >>I understand that maybe I may not be able to match the dealy exactly,but>>the question then becomes what is the optimum solution... possibly inthe>>LS sense or WLS. Trading off taps for accuracy could be an option. >> >>I could post my desired Group Delay if you wanna take a look. >> > >Sure, I'd be happy to take a look at it and be as helpful as I can be.Here are the coefficients (129 of them). Let me know what you guys think. The left half and right half are mirror images (even though this one is odd in length, you get the picture). 4.17540556450535 4.16892570809468 4.14987952696076 4.11748137825956 4.07644505368042 4.02316714185520 3.96295873506892 3.89298806991449 3.81809701372262 3.73631881041418 3.65165643988333 3.56297164315853 3.47321596121434 3.38201227533540 3.29118392127580 3.20103708321457 3.11230644987704 3.02589199180652 2.94156871929089 2.86072106403617 2.78235669917049 2.70820703930029 2.63674879837519 2.56988831519327 2.50584096903863 2.44647635962141 2.39004863335666 2.33813420394674 2.28936058294730 2.24470273135199 2.20354048767655 2.16587679957613 2.13228267829520 2.10134071229962 2.07533372622682 2.05087542084790 2.03259302120506 2.01445068962994 2.00420628225901 1.99231617421741 1.99066742451019 1.98510746480183 1.99294809817239 1.99398840332125 2.01268293327225 2.02086236986324 2.05245674214375 2.06870895639693 2.11627802867390 2.14215284793892 2.21040625098584 2.24848492635417 2.34489489599567 2.39963178447411 2.53671505441655 2.61632309044936 2.81680410081570 2.93809357066057 3.24860981745897 3.45210938909048 3.98998359950659 4.40450816372393 5.61795079975482 6.81342245624968 12.9254619264297 6.81342245624968 5.61795079975482 4.40450816372393 3.98998359950659 3.45210938909048 3.24860981745897 2.93809357066057 2.81680410081570 2.61632309044936 2.53671505441655 2.39963178447411 2.34489489599567 2.24848492635417 2.21040625098584 2.14215284793892 2.11627802867390 2.06870895639693 2.05245674214375 2.02086236986324 2.01268293327225 1.99398840332125 1.99294809817239 1.98510746480183 1.99066742451019 1.99231617421741 2.00420628225901 2.01445068962994 2.03259302120506 2.05087542084790 2.07533372622682 2.10134071229962 2.13228267829520 2.16587679957613 2.20354048767655 2.24470273135199 2.28936058294730 2.33813420394674 2.39004863335666 2.44647635962141 2.50584096903863 2.56988831519327 2.63674879837519 2.70820703930029 2.78235669917049 2.86072106403617 2.94156871929089 3.02589199180652 3.11230644987704 3.20103708321457 3.29118392127580 3.38201227533540 3.47321596121434 3.56297164315853 3.65165643988333 3.73631881041418 3.81809701372262 3.89298806991449 3.96295873506892 4.02316714185520 4.07644505368042 4.11748137825956 4.14987952696076 4.16892570809468 4.17540556450535






