setting slope in biquad~ filter

Questions and discussion about building and using Max for Live devices
Post Reply
charlybeck
Posts: 112
Joined: Sat Sep 18, 2010 1:42 pm

setting slope in biquad~ filter

Post by charlybeck » Thu Apr 23, 2020 10:42 pm

Hi,

can i some how set the slope (edge steepness) of a lo cut filter using biquad~ filter?

The filter graph has a input for Q and S. I'm not sure if they mean both would be the same or how to distinguish between Q and S set commands,

Often filters have a setting for 12 db/octave or 24 db /octave. This i wanna set.

I'm not sure wether i can set this with the coefficitents.... (I'm not so familar with the mathematics behind). If it is possible it would be great to post a sample patch.

Thanks! :)

ecuk
Posts: 91
Joined: Fri Jun 03, 2016 7:49 pm

Re: setting slope in biquad~ filter

Post by ecuk » Fri Apr 24, 2020 1:01 am

A single biquad filter, at least when used for lowpass or highpass, will always get you 12 dB/octave rolloff. If you want 24 dB/octave, you have to cascade two of them. The easiest way to do this in Max (for Live) ls to use a cascade~ object. And if, for example, you want 48 dB/octave, you use a cascade of four biquads.

You might want to look at the Max tutorials for filtering. These are best opened directly from Max’s own help because then you can open the tutorial patches, but here are web links to the same content without the patches:

https://docs.cycling74.com/max8/tutoria ... rchapter01

https://docs.cycling74.com/max8/tutoria ... rchapter02

You should also definitely watch Tim Place’s excellent video tutorials about filters in Max, beginning with:

https://cycling74.com/articles/a-tour-o ... ls-in-max/
MacBook Pro, macOS Catalina 10.15.6, 2.3GHz i7-1068NG7, 32GB – Live Suite 10.1.18, Max 8.1.5, Push 2, Zoom H6, ATH-M50x

charlybeck
Posts: 112
Joined: Sat Sep 18, 2010 1:42 pm

Re: setting slope in biquad~ filter

Post by charlybeck » Sat Apr 25, 2020 2:39 am

Great! Understood. Thanks!

But the filtergraph will always show as 12db/octave right?

Or can i switch it to 24/48 db/octave?

ecuk
Posts: 91
Joined: Fri Jun 03, 2016 7:49 pm

Re: setting slope in biquad~ filter

Post by ecuk » Sat Apr 25, 2020 3:47 am

It has been a while since I last did much with filtergraph~, but I believe that you can first use a filtergraph~ object in lowpass mode to determine a set of (five) coefficients that you want for each biquad. This would show you the response for 12 dB/octave.

For 24 dB/octave rolloff you then replicate this list and use the exact same coefficients for each of two cascaded biquads in a cascade~ object. In order to see the response curve of this 24 dB/octave cascaded filter you can send the replicated list, now with ten coefficients, into a second filtergraph~ object as part of a ‘cascade’ message (where this second filtergraph~ has already been set to mode 0, display mode).

For 48 dB/octave you would do the same but replicate the coefficients four times to have 20 coefficients, four identical sets of five. And so on.

I won’t guarantee that this is the best way to do these things. As with any kind of real programming—and Max is real programming, after all—there are almost always many ways to do more or less the same thing. In time you develop your own style and favourite way to do things, just as with creating music; no one person’s music is ‘correct’. Also, filter design is a rather deep rabbit hole once you begin to play with it. Nonetheless, the above is what I would start with, and I believe it should work.

For a bit of detail about the messages you need, in particular the ‘mode’ (or ‘display’, equivalent to ‘mode 0’) and ‘cascade’ messages, see:
https://docs.cycling74.com/max8/refpages/filtergraph~
MacBook Pro, macOS Catalina 10.15.6, 2.3GHz i7-1068NG7, 32GB – Live Suite 10.1.18, Max 8.1.5, Push 2, Zoom H6, ATH-M50x

charlybeck
Posts: 112
Joined: Sat Sep 18, 2010 1:42 pm

Re: setting slope in biquad~ filter

Post by charlybeck » Tue Apr 28, 2020 8:15 pm

charlybeck wrote:
Sat Apr 25, 2020 2:39 am
Great! Understood. Thanks!

But the filtergraph will always show as 12db/octave right?

Or can i switch it to 24/48 db/octave?
Ok i found how it works. Using the nfilters, params and options messagae of the filtergraph allows to configure it with severlal filters at once.

It will build the curve respecting the n filters causing a higher steepness if the filters are at the same cutoff.

The generated filter specification can then be sent to the cascade filter object.

I wrote a little patcher which configures all 4 filters to have the same cutoff/q/gain/options and disable editing for all filters. That did the job.

Post Reply