DSPRelated.com
Forums

How to design this complex filter?

Started by canmc October 6, 2004
"Jon Harris" <goldentully@hotmail.com> wrote in message news:<2sj6n3F1l8fjeU1@uni-berlin.de>...
> http://www.harmony-central.com/Computer/Programming/Audio-EQ-Cookbook.txt shows > how to compute peaking/notch filters (as well as some other common ones). > String together 7 of those biquads in series and you should be in business. > > "canmc" <canmcbk@yahoo.com> wrote in message > news:a01b5002.0410051902.4cccb48e@posting.google.com... > > Hi all. > > I'm in trouble on designing this linear time-invariant digital > > filter. It has five peaks and two notches in its magnitude frequency > > response. Each peak/notch is specified by its frequency, 3dB-bandwidth > > and magnitude. These parameters and of course, the sampling frequency, > > can be chosen arbitrarily. Please give me any solution. Thanks in > > advance. > > Best regards, > > Canmc
Hi. It's not simple as you think. Because it's impossible to control the gain of each peak/notch in the desired magnitude response if we combine some peak/notch filters in series. Moreover, it's not a good idea to design a peak/notch filter using bilinear transform because the nature of warping frequency will result in the difference between the peak/notch frequency of an analog filter with that of a digital one. Thanks and best regards, Canmc
canmcbk@yahoo.com (canmc) wrote in message news:<a01b5002.0410082050.19990c2d@posting.google.com>...
> davec@quantized.com (David Coffey) wrote > > canmcbk@yahoo.com (canmc) wrote in message > > > I'm in trouble on designing this linear time-invariant digital > > > filter. It has five peaks and two notches in its magnitude frequency > > > response. Each peak/notch is specified by its frequency, 3dB-bandwidth > > > and magnitude. These parameters and of course, the sampling frequency, > > > can be chosen arbitrarily. > > > Canmc > > > > The filter you need only looks > > complicated because you are trying to think of it as one big filter. > > As John has already pointed out, you need a bunch of filters.Another point of caution, > > if you are using peaking filters like this you need to apply them in > > parallel > > and not in series as Jon pointed out. I.e. sum the outputs of the > > seperate sections. Hope this helps. > > Hi. > It is simple to implement a digital resonator/anti-resonator given the > parameters as I said previously. The problem is that when these > peak/notch filters are combined in series/parallel, the parameters of > each peak/notch in the magnitude response of the resulting filter will > be changed. It's hard for me to find out how to combine the component > filters and the parameters of each to meet a given magnitude response. > Combining some peak filters in parallel as you proposed will result in > some notches undesired in the resulting magnitude response. Thanks > anyway. > > Regards, > Canmc
If the filter can be FIR as you pointed out above you could use Parks-McClellan to derive co-efficients for an arbitrary magnitude response. However, in my experience, keeping implementations like this as close to the physical reality of the model is best. As (no doubt you're aware) the vocal tract is based on a series of resonant cavities so (IMHO) resons are a good fit. I take you're point about combined effects of multiple resons. I have experienced this too, it does take tweaking. As the resons are all pole based (the zeros are placed at the origin of the unit circle for convenience, though you are free to place them at +/-1 to remove DC and aliasing) you get very weird results when you bring the poles too close together. You might be able to try a basic optimisation approach by tweaking pole radii and angles to minimise the mean squared error between your actual and desired response. Hope this helps.
canmc wrote:

> Jerry Avins <jya@ieee.org> wrote in message news:<cjvol0$o1j$1@bob.news.rcn.net>... > >>canmc wrote: >> >>>Hi all. >>> I'm in trouble on designing this linear time-invariant digital >>>filter. It has five peaks and two notches in its magnitude frequency >>>response. Each peak/notch is specified by its frequency, 3dB-bandwidth >>>and magnitude. These parameters and of course, the sampling frequency, >>>can be chosen arbitrarily. Please give me any solution. Thanks in >>>advance. >>> Best regards, >>> Canmc >> >>What do you want to use it for? IIR, or FIR? More than two notches are >>needed to separate five peaks, so something is missing in the spec. >> >>Jerry > > > Hi Jerry, > > Thanks for your interest. The filter is intended to be used for > synthesizing any single voiced sound from glottal waveform. But > another more important use of its is that its inverse version,e.g the > inverse filter, can be used to obtain the glottal source from any > single voiced speech waveform. The filter can be IIR or FIR. > > >>More than two notches are needed to separate five peaks, so something is >>missing in the spec. > > > I don't understand this. Please give me further explanation. > > Best regards, > Canmc
It seems I didn't guess what you meant either. My current guess is that you want a filter that passes most frequencies at some intermediate amplitude, with five narrow bands of increased transmission -- peaks -- and tow narrow bands with little or no transmission -- notches. If that's right, then what I wrote before is irrelevant. By posting more specific requirements, you will likely get more specific help. Jerry -- When a discovery is new, people say, "It isn't true." When it becomes demonstrably true, they say, "It isn't useful." Later, when its utility is evident, they say, "So what? It's old." a paraphrase of William James &#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;
canmc wrote:

> "Jon Harris" <goldentully@hotmail.com> wrote in message news:<2sj6n3F1l8fjeU1@uni-berlin.de>... > >>http://www.harmony-central.com/Computer/Programming/Audio-EQ-Cookbook.txt shows >>how to compute peaking/notch filters (as well as some other common ones). >>String together 7 of those biquads in series and you should be in business. >> >>"canmc" <canmcbk@yahoo.com> wrote in message >>news:a01b5002.0410051902.4cccb48e@posting.google.com... >> >>>Hi all. >>> I'm in trouble on designing this linear time-invariant digital >>>filter. It has five peaks and two notches in its magnitude frequency >>>response. Each peak/notch is specified by its frequency, 3dB-bandwidth >>>and magnitude. These parameters and of course, the sampling frequency, >>>can be chosen arbitrarily. Please give me any solution. Thanks in >>>advance. >>> Best regards, >>> Canmc > > > Hi. > It's not simple as you think. Because it's impossible to control the > gain of each peak/notch in the desired magnitude response if we > combine some peak/notch filters in series. Moreover, it's not a good > idea to design a peak/notch filter using bilinear transform because > the nature of warping frequency will result in the difference between > the peak/notch frequency of an analog filter with that of a digital > one. > > Thanks and best regards, > Canmc
FIR filters, which have linear phase, can be cascaded without the interference effects you mention. Filters designed using the bilinear transform can be "pre warped" to compensate for the frequency shift you mention. See http://www.google.com/search?q=bilinear+prewarp Jerry -- When a discovery is new, people say, "It isn't true." When it becomes demonstrably true, they say, "It isn't useful." Later, when its utility is evident, they say, "So what? It's old." a paraphrase of William James &#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;
Jerry Avins <jya@ieee.org> wrote in message news:<2sqeo1F1oakqjU1@uni-berlin.de>...
> canmc wrote: > > > Jerry Avins <jya@ieee.org> wrote in message news:<cjvol0$o1j$1@bob.news.rcn.net>... > > > >>canmc wrote: > >> > >>>Hi all. > >>> I'm in trouble on designing this linear time-invariant digital > >>>filter. It has five peaks and two notches in its magnitude frequency > >>>response. Each peak/notch is specified by its frequency, 3dB-bandwidth > >>>and magnitude. These parameters and of course, the sampling frequency, > >>>can be chosen arbitrarily. Please give me any solution. Thanks in > >>>advance. > >>> Best regards, > >>> Canmc > >> > >>What do you want to use it for? IIR, or FIR? More than two notches are > >>needed to separate five peaks, so something is missing in the spec. > >> > >>Jerry > > > > > > Hi Jerry, > > > > Thanks for your interest. The filter is intended to be used for > > synthesizing any single voiced sound from glottal waveform. But > > another more important use of its is that its inverse version,e.g the > > inverse filter, can be used to obtain the glottal source from any > > single voiced speech waveform. The filter can be IIR or FIR. > > > > > >>More than two notches are needed to separate five peaks, so something is > >>missing in the spec. > > > > > > I don't understand this. Please give me further explanation. > > > > Best regards, > > Canmc > > It seems I didn't guess what you meant either. My current guess is that > you want a filter that passes most frequencies at some intermediate > amplitude, with five narrow bands of increased transmission -- peaks -- > and tow narrow bands with little or no transmission -- notches. If > that's right, then what I wrote before is irrelevant. By posting more > specific requirements, you will likely get more specific help. > > Jerry
I'm sorry for my inadequate information making you or someone else inconvenient. My work is to design some filters for speech synthezing and glottal inverse filtering. These two problems could be solved by using the desired filter above and its inverse filter, respectively. The former used to synthesize speech has 5 peaks according to 5 formants of voiced sounds and 2 notches representing 2 anti-formants of nasals. Hope this help. Canmc.
Jerry Avins <jya@ieee.org> wrote in message news:<2sqg16F1p63onU1@uni-berlin.de>...
> canmc wrote: > > > "Jon Harris" <goldentully@hotmail.com> wrote in message news:<2sj6n3F1l8fjeU1@uni-berlin.de>... > > > >>http://www.harmony-central.com/Computer/Programming/Audio-EQ-Cookbook.txt shows > >>how to compute peaking/notch filters (as well as some other common ones). > >>String together 7 of those biquads in series and you should be in business. > >> > >>"canmc" <canmcbk@yahoo.com> wrote in message > >>news:a01b5002.0410051902.4cccb48e@posting.google.com... > >> > >>>Hi all. > >>> I'm in trouble on designing this linear time-invariant digital > >>>filter. It has five peaks and two notches in its magnitude frequency > >>>response. Each peak/notch is specified by its frequency, 3dB-bandwidth > >>>and magnitude. These parameters and of course, the sampling frequency, > >>>can be chosen arbitrarily. Please give me any solution. Thanks in > >>>advance. > >>> Best regards, > >>> Canmc > > > > > > Hi. > > It's not simple as you think. Because it's impossible to control the > > gain of each peak/notch in the desired magnitude response if we > > combine some peak/notch filters in series. Moreover, it's not a good > > idea to design a peak/notch filter using bilinear transform because > > the nature of warping frequency will result in the difference between > > the peak/notch frequency of an analog filter with that of a digital > > one. > > > > Thanks and best regards, > > Canmc > > FIR filters, which have linear phase, can be cascaded without the > interference effects you mention. Filters designed using the bilinear > transform can be "pre warped" to compensate for the frequency shift you > mention. See http://www.google.com/search?q=bilinear+prewarp > > Jerry
Actually, I don't think the desired filter could be a FIR one. Because it has some dominant peaks in magnitude response as a typical plot posted by Richard: http://www.brunel.ac.uk/depts/ee/Research_Programme/COM/Home_Esfandiar/Formants.htm Each peak would be implemented by a pair of complex-conjugated poles. So the filter would be an IIR one. Canmc.
canmc wrote:

> Jerry Avins <jya@ieee.org> wrote in message news:<2sqg16F1p63onU1@uni-berlin.de>... > >>canmc wrote: >> >> >>>"Jon Harris" <goldentully@hotmail.com> wrote in message news:<2sj6n3F1l8fjeU1@uni-berlin.de>... >>> >>> >>>>http://www.harmony-central.com/Computer/Programming/Audio-EQ-Cookbook.txt shows >>>>how to compute peaking/notch filters (as well as some other common ones). >>>>String together 7 of those biquads in series and you should be in business. >>>> >>>>"canmc" <canmcbk@yahoo.com> wrote in message >>>>news:a01b5002.0410051902.4cccb48e@posting.google.com... >>>> >>>> >>>>>Hi all. >>>>> I'm in trouble on designing this linear time-invariant digital >>>>>filter. It has five peaks and two notches in its magnitude frequency >>>>>response. Each peak/notch is specified by its frequency, 3dB-bandwidth >>>>>and magnitude. These parameters and of course, the sampling frequency, >>>>>can be chosen arbitrarily. Please give me any solution. Thanks in >>>>>advance. >>>>> Best regards, >>>>> Canmc >>> >>> >>>Hi. >>>It's not simple as you think. Because it's impossible to control the >>>gain of each peak/notch in the desired magnitude response if we >>>combine some peak/notch filters in series. Moreover, it's not a good >>>idea to design a peak/notch filter using bilinear transform because >>>the nature of warping frequency will result in the difference between >>>the peak/notch frequency of an analog filter with that of a digital >>>one. >>> >>>Thanks and best regards, >>>Canmc >> >>FIR filters, which have linear phase, can be cascaded without the >>interference effects you mention. Filters designed using the bilinear >>transform can be "pre warped" to compensate for the frequency shift you >>mention. See http://www.google.com/search?q=bilinear+prewarp >> >>Jerry > > > Actually, I don't think the desired filter could be a FIR one. Because > it has some dominant peaks in magnitude response as a typical plot > posted by Richard: > http://www.brunel.ac.uk/depts/ee/Research_Programme/COM/Home_Esfandiar/Formants.htm > Each peak would be implemented by a pair of complex-conjugated poles. > So the filter would be an IIR one. > > Canmc.
It is possible to design FIR filters for responses of any arbitrary shape. Maybe some others will post their favorite programs for that. Jerry -- Engineering is the art of making what you want from things you can get. &#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;
davec@quantized.com (David Coffey) wrote in message news:<163e03dd.0410090548.736f6192@posting.google.com>...
> canmcbk@yahoo.com (canmc) wrote in message news:<a01b5002.0410082050.19990c2d@posting.google.com>... > > davec@quantized.com (David Coffey) wrote > > > canmcbk@yahoo.com (canmc) wrote in message > > > > I'm in trouble on designing this linear time-invariant digital > > > > filter. It has five peaks and two notches in its magnitude frequency > > > > response. Each peak/notch is specified by its frequency, 3dB-bandwidth > > > > and magnitude. These parameters and of course, the sampling frequency, > > > > can be chosen arbitrarily. > > > > Canmc > > > > > > The filter you need only looks > > > complicated because you are trying to think of it as one big filter. > > > As John has already pointed out, you need a bunch of filters.Another point of caution, > > > if you are using peaking filters like this you need to apply them in > > > parallel > > > and not in series as Jon pointed out. I.e. sum the outputs of the > > > seperate sections. Hope this helps. > > > > Hi. > > It is simple to implement a digital resonator/anti-resonator given the > > parameters as I said previously. The problem is that when these > > peak/notch filters are combined in series/parallel, the parameters of > > each peak/notch in the magnitude response of the resulting filter will > > be changed. It's hard for me to find out how to combine the component > > filters and the parameters of each to meet a given magnitude response. > > Combining some peak filters in parallel as you proposed will result in > > some notches undesired in the resulting magnitude response. Thanks > > anyway. > > > > Regards, > > Canmc > > > You might be able to try a basic optimisation approach by tweaking > pole radii and angles to minimise the mean squared error between > your actual and desired response. Hope this helps.
Do you mean there is no solution in terms of closed-form formula? Is it impossible to find the filter's general transfer function meeting exactly such requirements in magnitude response?
"canmc" <canmcbk@yahoo.com> wrote in message
news:a01b5002.0410090055.7e3c675@posting.google.com...
> "Jon Harris" <goldentully@hotmail.com> wrote in message
news:<2sj6n3F1l8fjeU1@uni-berlin.de>...
> > http://www.harmony-central.com/Computer/Programming/Audio-EQ-Cookbook.txt
shows
> > how to compute peaking/notch filters (as well as some other common ones). > > String together 7 of those biquads in series and you should be in business. > > > > "canmc" <canmcbk@yahoo.com> wrote in message > > news:a01b5002.0410051902.4cccb48e@posting.google.com... > > > Hi all. > > > I'm in trouble on designing this linear time-invariant digital > > > filter. It has five peaks and two notches in its magnitude frequency > > > response. Each peak/notch is specified by its frequency, 3dB-bandwidth > > > and magnitude. These parameters and of course, the sampling frequency, > > > can be chosen arbitrarily. Please give me any solution. Thanks in > > > advance. > > > Best regards, > > > Canmc > > Hi. > It's not simple as you think. Because it's impossible to control the > gain of each peak/notch in the desired magnitude response if we > combine some peak/notch filters in series. Moreover, it's not a good > idea to design a peak/notch filter using bilinear transform because > the nature of warping frequency will result in the difference between > the peak/notch frequency of an analog filter with that of a digital > one.
Regarding your first issue, I guess I don't understand the problem well enough to know why this doesn't work. Regarding the second issue, the equations in the link I listed above already take into account the warping effect, so the frequencies are accurate. (However, the shapes of peaks are a little "squished" near the Nyquist frequency.)
"Jon Harris" <goldentully@hotmail.com> wrote in message news:<2svubjF1qcaj5U1@uni-berlin.de>...
> "canmc" <canmcbk@yahoo.com> wrote in message > news:a01b5002.0410090055.7e3c675@posting.google.com... > > "Jon Harris" <goldentully@hotmail.com> wrote in message > news:<2sj6n3F1l8fjeU1@uni-berlin.de>... > > > http://www.harmony-central.com/Computer/Programming/Audio-EQ-Cookbook.txt > shows > > > how to compute peaking/notch filters (as well as some other common ones). > > > String together 7 of those biquads in series and you should be in business. > > > > > > "canmc" <canmcbk@yahoo.com> wrote in message > > > news:a01b5002.0410051902.4cccb48e@posting.google.com... > > > > Hi all. > > > > I'm in trouble on designing this linear time-invariant digital > > > > filter. It has five peaks and two notches in its magnitude frequency > > > > response. Each peak/notch is specified by its frequency, 3dB-bandwidth > > > > and magnitude. These parameters and of course, the sampling frequency, > > > > can be chosen arbitrarily. Please give me any solution. Thanks in > > > > advance. > > > > Best regards, > > > > Canmc > > > > Hi. > > It's not simple as you think. Because it's impossible to control the > > gain of each peak/notch in the desired magnitude response if we > > combine some peak/notch filters in series. Moreover, it's not a good > > idea to design a peak/notch filter using bilinear transform because > > the nature of warping frequency will result in the difference between > > the peak/notch frequency of an analog filter with that of a digital > > one. > > Regarding your first issue, I guess I don't understand the problem well enough > to know why this doesn't work. Regarding the second issue, the equations in the > link I listed above already take into account the warping effect, so the > frequencies are accurate. (However, the shapes of peaks are a little "squished" > near the Nyquist frequency.)
I tried implementing the filter with 5 peaks by cascading 5 two-pole filters (for simplicity, 2 notches are not mentioned here). Each of them is performed as shown in the link below: http://www-ccrma.stanford.edu/~jos/filters/Two_Pole.html According to this design, for each resonator, the peak frequency and 3dB-bandwidth are defined by the poles' angle and radius respectively, and the peak gain is controled by the numerator coefficient of the transfer function. For a resonator, it's ok. When cascading these resonators, I found that, in the magnitude response of the resulting system, the peak frequencies and the 3dB-bandwidths of the peaks are nearly the same as those of stand-alone resonators but the gains at peaks are changed. I also found out no way to individually adjust the gains at peak frequencies because each gain at a certain frequency will result in the same gain at all other ones. It's the problem. Can anyone help me?