filter with arbitrary and variable rolloff

Started by banton May 15, 2006
Hi,

How can I implement a filter (lowpass) with variable slope.  
1st order gives me 6db per octave and
2nd order 12db per octave.  So what can I do if I need
8db or 4.2db attenuation per octave.  Could fractional delay lines
instead of unit delays be a starting point?

gr.
Anton




"banton" <bantone@web.de> wrote in message 
news:KsidnfBIb9nq6vXZRVn-gg@giganews.com...
> Hi, > > How can I implement a filter (lowpass) with variable slope. > 1st order gives me 6db per octave and > 2nd order 12db per octave. So what can I do if I need > 8db or 4.2db attenuation per octave. Could fractional delay lines > instead of unit delays be a starting point? > > gr.
One way is to use a design program that will accept a "continuous" definition of desired response. Then, generate the response sequence of values that you want. Then, let the program design the filter. Surely you don't need 8dB/octave for too many octaves, right? Fred
Fred wrote:
> One way is to use a design program that will accept a "continuous" > definition of desired response. Then, generate the response sequence of
> values that you want. Then, let the program design the filter. Surely
you
> don't need 8dB/octave for too many octaves, right?
But what I need is a _variable_ slope. My question was a bit to vague. I need a way to recalculate the coefficients on the fly. I found this material about a 3db rolloff filter: http://www.firstpr.com.au/dsp/pink-noise/ A cite from this source: ---- It comes back to the roll-off of a first order low-pass filter being too steep at -6dB/octave. The only thing I could think of with a softer roll-off was the transition from 0dB/oct to -6dB/octave at the "knee" of such a filter. By positioning enough of these knees in a "staircase" a good -3dB/oct slope can be made. --- I wonder if there is a way to use a similar method but with the possibility to change the slope in realtime. gr. Anton
"banton" <bantone@web.de> wrote in message 
news:ivydnQ7nQtts2vTZRVn-gg@giganews.com...
> Fred wrote: >> One way is to use a design program that will accept a "continuous" >> definition of desired response. Then, generate the response sequence of > >> values that you want. Then, let the program design the filter. Surely > you >> don't need 8dB/octave for too many octaves, right? > > But what I need is a _variable_ slope. My question was a bit to vague. I > need a way to recalculate the coefficients on the fly. I found this > material about a 3db rolloff filter: > > http://www.firstpr.com.au/dsp/pink-noise/ > A cite from this source: > ---- > It comes back to the roll-off of a first order low-pass filter being too > steep at -6dB/octave. The only thing I could think of with a softer > roll-off was the transition from 0dB/oct to -6dB/octave at the "knee" of > such a filter. By positioning enough of these knees in a "staircase" a > good -3dB/oct slope can be made. > --- > > I wonder if there is a way to use a similar method but with the > possibility > to change the slope in realtime. > > gr. > Anton
Anton, Oh, OK. Well, the notion of a table lookup comes to mind. Design a bunch of filters that span the space of possibilities and apply the filter you want. The real trick is how to change from one filter to another. You might make all the filters (FIR filters) the same length and transition the coefficient values from one set to another over the temporal length of the filter. That way there would be a gradual "transient" in changing filters. Example: original filter: filter 1 h1(n) = [a b c d e f g h i] length = 9 to transition to: filter 2 h2(n) = [j k l m n o p q r] length = 9 filter 11 h11(n) = h1(n) filter 12 h12(n) = h1*8/9 + h2/9 filter 12 h13(n) = h1*7/9 + h2*2/9 . . filter 18 h18(n) = h1/9 + h2*8/9 filter 19 h19(n) = h2(n) Of course, you keep the interim values of the input data to apply to each of these new filters at each sample time. That's the same as if you'd not changed the filter coefficients at all - a circular buffer or ..... If you consider what this does, it's like having the two filters that are in transition in parallel and you increase the output from the new one as you decrease the output from the original one. It could be more gradual and it could be more abrupt. I simply chose a transition time that's equivalent to the length of the impulse response of each filter - or its settling time given a steady state input. Fred
Fred wrote:
>Oh, OK. Well, the notion of a table lookup comes to mind. Design a
bunch
>of filters that span the space of possibilities and apply the filter you
>want. The real trick is how to change from one filter to another. You >might make all the filters (FIR filters) the same length and transition
the
>coefficient values from one set to another over the temporal length of
the
>filter. That way there would be a gradual "transient" in changing
filters. That is a straight forward way. I'll try it. What do you think is a good way to design the tables of coefficients for the fir filters. Ifft and windowing? That might be a good working solution, but just for curiousity I still would like to know if the fractional delay line idea is the wrong path in general or if it is just too complicated (overkill). How does a filter change if I use fractional delays (allpass based or lagrange interpolation) instead of the unitdelays? Usually they are used for comb filters to achieve flexible tuning of resonance frequencies, but I think it could also be possible to achieve slope control that way. gr. Anton
banton wrote:

> Fred wrote: > >>Oh, OK. Well, the notion of a table lookup comes to mind. Design a > > bunch > >>of filters that span the space of possibilities and apply the filter you > > >>want. The real trick is how to change from one filter to another. You >>might make all the filters (FIR filters) the same length and transition > > the > >>coefficient values from one set to another over the temporal length of > > the > >>filter. That way there would be a gradual "transient" in changing > > filters. > > That is a straight forward way. I'll try it. > What do you think is a good way to design the tables of coefficients > for the fir filters. Ifft and windowing? > > That might be a good working solution, but just for curiousity I still > would like to know if the fractional delay line idea is the wrong path in > general or if it is just too complicated (overkill). > How does a filter change if I use fractional delays (allpass based or > lagrange interpolation) instead of the unitdelays? > Usually they are used for comb filters to achieve flexible tuning of > resonance frequencies, but I think it could also be possible to > achieve slope control that way.
Anton, With linear-phase filters, you need only slopes between flat and 6 dB/octave. You can just add (subtract) integer multiples of 6 dB/octave to (from) them. When this is done with analog or IIR filters, up breaks alternate with down breaks on the Bode plot, and the overall slope is determined by their (logarithmic) spacing. There are analytic ways to optimize flatness, but eyeball analysis usually suffices. Jerry -- Engineering is the art of making what you want from things you can get. &#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;
"Jerry Avins" <jya@ieee.org> wrote in message 
news:peidnVuREPUPavTZnZ2dnUVZ_tudnZ2d@rcn.net...
> banton wrote: > > Anton, > > With linear-phase filters, you need only slopes between flat and 6 > dB/octave. You can just add (subtract) integer multiples of 6 dB/octave > to (from) them. > > When this is done with analog or IIR filters, up breaks alternate with > down breaks on the Bode plot, and the overall slope is determined by > their (logarithmic) spacing. There are analytic ways to optimize > flatness, but eyeball analysis usually suffices. >
Jerry, I'm intrigued by your comment and don't fully understand yet. How do you add/subtract integer multiples or any of the others? Cascade the filters? Fred
"banton" <bantone@web.de> wrote in message 
news:lr-dnWVG__V5xfTZnZ2dnUVZ_tSdnZ2d@giganews.com...
> > That is a straight forward way. I'll try it. > What do you think is a good way to design the tables of coefficients > for the fir filters. Ifft and windowing?
Either the windowing method of filter design or a real optimizing filter design program that allows you to specify the desired function continuously - I'm not sure which program might do that. In contrast, the Parks-McClellan program has you define constant gain across each defined band. I'm not sure if defining lots of mini-bands would work but it might...
> > That might be a good working solution, but just for curiousity I still > would like to know if the fractional delay line idea is the wrong path in > general or if it is just too complicated (overkill). > How does a filter change if I use fractional delays (allpass based or > lagrange interpolation) instead of the unitdelays? > Usually they are used for comb filters to achieve flexible tuning of > resonance frequencies, but I think it could also be possible to > achieve slope control that way.
I don't know. Fred
banton wrote:

> How can I implement a filter (lowpass) with variable slope. > 1st order gives me 6db per octave and 2nd order 12db per octave. > So what can I do if I need 8db or 4.2db attenuation per octave. > Could fractional delay lines instead of unit delays be a starting > point?
If you take any filter and replace each unit delay with a first-order allpass filter, you get what's called a frequency-warped filter. Say the original filter's frequency spectrum is H(e^jw); then the warped filter spectrum is H(e^j f(w)) where the shape of the function f depends on the allpass coefficient. You could certainly try to approximate a given slope starting from a simple lowpass filter. See for more info: http://google.com/search?q=frequency+warped+fir Martin -- No wonder that illegitimate children are commonly the greatest minds; they are the result of an hour full of wit, marital ones often spring from boredom. --Theodor Gottlieb von Hippel
Fred Marshall wrote:

  ...

> Jerry, > > I'm intrigued by your comment and don't fully understand yet. How do you > add/subtract integer multiples or any of the others? Cascade the filters?
Precisely! Phase effects can be bothersome, but linear-phase filters avoid the question, and minimum-phase implementations usually work together with no problem. The difference between cascading 3- and 6-dB/octave filters, and building a single 9/dB/octave filter with 3- and 6-dB/octave sections is possible interaction in the first case, but the restrictions on phase behavior blur the distinction. Jerry -- Engineering is the art of making what you want from things you can get. &#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;