Variable-Slope Highpass Filter
I'm trying to implement a variable-slope highpass filter with the filtergraph, but changing the slope seems to also change the resonance at the cutoff frequency. The steeper the slope, the more the cutoff frequency is boosted. Is there a way to change the slope without changing the resonance? Thanks.
not really, but when you put 3 filters in series, you can
create a 4th filter which artificially tries to lower the
"resonance" effct. using filtergraph with the cascade command
can help a lot to set up such a filter.
Thanks, I'll give it a shot.
Is my thinking correct? The [onepole~] help file shows an example where it is used as a highpass and==according to the reference--it has a -6dB/Octave slope. Thus, If I put them in a cascade with each having the same cutoff frequency, does that mean that the slope steepens by -6dB/Octave for each successive [onepole~] while maintaining the same cutoff frequency?
bkshepard wrote on Tue, 21 July 2009 22:18If I put them in a cascade with each having the same cutoff frequency, does that mean that the slope steepens by -6dB/Octave for each successive [onepole~] while maintaining the same cutoff frequency?
basically yes, with every pole the slope can be 6 dB/oct steeper.
but the result depends on where you exactly put the poles (and zeros) - something which [onepole~] does internally for you, and therefore which you can't control yourself. experimenting with [biquad~] is better in this respect.
there are a lot of different pole/zero-calculation methods, that optimize the filter for different tasks (stopband attenuation, passband/stopband ripple, rolloff, execution speed etc.).
one of these methods is the so called chebyshev filter design.
if you want to experiment with that, you can find a mxj-java class [vb.chebycoeff] at http://www.esbasel.ch/Downloads/MaxMSP-Objects.htm
this class calculates the filter coeffs for a particular filter order (number of poles) which you can pass to [cascade~] to execute the filter (low/highpass switchable).
if you're on a mac, you might like to try [vb.cheby~], too, which calculates the coeffs and executes the filter in one object. the help file also shows what the amplitude spectra of the cascaded biquad filter stages look like.
(was made for max4, but should work in max5, too).
vb
Thanks vb!
I'm still trying to wrap my brain around [biquad]. Is there a way to relate the Q or slope from [filtergraph] to a common -ndB/octave? Does a slope of 1.0 in a highpass equal -3dB/octave or something like that?
Here are two equations that convert the filter bandwidth to q (quality factor) and back again. When the bandwidth is 1 the -3dB points will be an one octave apart.
lh
Wow, those are quite the equations! Sorry if this is a dumb question, but--in the equation above the [filtergraph] object--when you say "When the bandwidth is 1" are you referring to the [float] before the equation, or the one after the equation?
In other words, is:
1.
|
[expr]
|
1.414214
a bandwidth of 1, or is:
1.388484
|
[expr]
1.
a bandwidth of 1?
Thanks so much for this!
bkshepard wrote on Thu, 23 July 2009 09:44Thanks vb!
I'm still trying to wrap my brain around [biquad]. Is there a way to relate the Q or slope from [filtergraph] to a common -ndB/octave? Does a slope of 1.0 in a highpass equal -3dB/octave or something like that?
the steepness yes, the Q not really, a "Q"s maximmum amplitude
depends on a few factors.
what is important for you to know when building filters with
biquad is only the folliwing simple rule:
when you use ONE biquad for a lowpass and allow it to
have its Q modulated from 0-100%, and you want to put 2 of
these filters in series to archive *2 the decibels (or *2
the slope) you have to /2 the Q setting, i.e. limit the Q
parameter to what has been 50% before.
the resonances kind of simply adds up when stacked, at
least thats a solution for practice.
-110
The equation above the [filtergraph~] converts bandwidth in octaves to the Q. The one below is the reverse and converts the Q factor into the bandwidth in octaves. Note: when the bandwidth is 1, the Q is 1.414214 and the -3dB points are an octave apart. I hope that clears things up a bit.
lh
Crystal clear! Thanks so much!
bkshepard wrote on Thu, 23 July 2009 09:44I'm still trying to wrap my brain around [biquad]. Is there a way to relate the Q or slope from [filtergraph] to a common -ndB/octave?
If you look close at the results of changing the q of a lowpass in filtergraph, you will realize that q does not relate to the -ndB/octave at all, it remains constant. The number of poles will define the -ndB/octave.
1 pole = -6dB (onepole~),
2 poles (biquad~) = -12 dB,
4+ poles (cascade~) >= -24 dB/octave...
Bandwith is controlled by Q, which has an effect on the steepness of the curve only around the resonance frequency...
Stefan
volker b�hm wrote on Wed, 22 July 2009 12:44one of these methods is the so called chebyshev filter design.
if you want to experiment with that, you can find a mxj-java class [vb.chebycoeff] at http://www.esbasel.ch/Downloads/MaxMSP-Objects.htm
This is a wonderful java class.
Are there the sources around? I guess it should be possible to ask for the actual sampling rate within the java code itself...
Stefan
Quote:This is a wonderful java class.
Are there the sources around? I guess it should be possible to ask for the actual sampling rate within the java code itself...
thanks - this is a pretty straight port of the basic code from steven smith's dsp-guide http://www.dspguide.com/ch20/4.htm
with the exception that i implemented it using biquad stages (for stability reasons and in order to use it with [cascade~]).
for convenience i have added the java source file (along with a small bug fix) to the archive now, so you might like to download again:http://www.esbasel.ch/Downloads/chebycoeff.zip
about sr: there doesn't seem to be an easy way to get the sr of the system/soundcard in a non-signal external. and i didn't want to go down the route of extending MSPObject and implementing a perform routine since this object doesn't do any signal processing itself.
volker.