Forums > MaxMSP

filtergraph, nfilter and pattrstorage

March 5, 2008 | 6:58 pm

hi

I’m using a bank of filtergraphs in [nfilter 2] mode to create
variable bandpass filters, and I want to store and recall the filter
settings using pattr.

pattr doesn’t connect to filtergraph, so I’m going to have to use some
scheme involving number boxes. (The other option is to use preset
values sent to filtergraph from message boxes).

What I haven’t been able to find in the docs is – how to address the 2
separate filter curves in filtergraph.
I’m assuming that I can precede the freq/gain/Q settings with a
message and a number to indicate which curve – but what is it?!

(I also noticed that the 7th outlet of filtergraph (indicates which
filter is being edited) doesn’t seem to do anything when I change
values using the mouse – a number box attached there jumps to [1] when
I move either of the 2 curves, and that’s it!)

So the question is – how to address the separate curves in a
filtergraph using messages.

thanks

David


March 5, 2008 | 7:55 pm

"params filter-index (int – starting at 0) freq amp Q" – "setparams
filter freq amp Q" causes no output – I believe.

On 5 mars 08, at 19:58, David Stevens wrote:

> hi
>
> I’m using a bank of filtergraphs in [nfilter 2] mode to create
> variable bandpass filters, and I want to store and recall the
> filter settings using pattr.
>
> pattr doesn’t connect to filtergraph, so I’m going to have to use
> some scheme involving number boxes. (The other option is to use
> preset values sent to filtergraph from message boxes).
>
> What I haven’t been able to find in the docs is – how to address
> the 2 separate filter curves in filtergraph.
> I’m assuming that I can precede the freq/gain/Q settings with a
> message and a number to indicate which curve – but what is it?!
>
> (I also noticed that the 7th outlet of filtergraph (indicates which
> filter is being edited) doesn’t seem to do anything when I change
> values using the mouse – a number box attached there jumps to [1]
> when I move either of the 2 curves, and that’s it!)
>
> So the question is – how to address the separate curves in a
> filtergraph using messages.
>
> thanks
>
> David
>


March 5, 2008 | 7:58 pm

Hi !
That’s in MSPreferenceManual :
"If more than five values are sent, they are interpreted as sets of cascaded biquad coefficients (see the cascade message)."

the cascade message works only in display mode but did you try to send all the 5-coeffs groups packed in a sigle list ?


March 5, 2008 | 9:48 pm

Manuel had the answer I needed – I missed the second half of the
params message instructions in the manual. That’s what comes of trying
to read the manual onscreen with dodgy eyesight. (Really – I read
better with my glasses off, but the screen that has the manual on is a
bit far away!)

Thanks guys – I printed the filtergraph pages out now, so I can read
it properly.

David

On 5 Mar 2008, at 19:58, BenCello wrote:

>
> Hi !
> That’s in MSPreferenceManual :
> "If more than five values are sent, they are interpreted as sets of
> cascaded biquad coefficients (see the cascade message)."
>
> the cascade message works only in display mode but did you try to
> send all the 5-coeffs groups packed in a sigle list ?


March 29, 2008 | 7:34 am

A student of mine ran into the similar problem trying to use [preset] with a patch. My suggestion was to create a tool to load biquad filter coefficient lists into a [coll]. You can then call up these "presets" either by manipulating [coll] directly or you can include the retrieve data index number box in some larger [pattr] or [preset] setup.

It is too bad we don’t have access to [filtergraph~] with [pattr] because it would really be cool to crossfade between different filter setups with [pattrstorage].

#P window setfont "Sans Serif" 12.;
#P window linecount 1;
#P comment 642 602 194 196620 this one shows output of [coll];
#P window setfont Helvetica 9.;
#P user filtergraph~ 607 631 256 128 21 9 20. 20000. 0.0625 16. 0 1 1 0 0 1 1;
#X frgb 170 170 170;
#X brgb 209 209 209;
#X rgb2 0 0 0;
#X rgb3 130 130 130;
#X rgb4 0 0 0;
#X rgb5 76 108 172;
#X rgb6 210 74 54;
#X rgb7 255 22 22;
#X linmarkers 5512.5 11025. 16537.5;
#X logmarkers 10. 100. 1000. 10000.;
#X nfilters 3;
#X setfilter 2 0 1 0 0 187.640213 13.458423 9.26696 0. 0. 0. 0. 0. 0.;
#X setfilter 1 0 1 0 0 678.533997 11.320516 5.333812 0. 0. 0. 0. 0. 0.;
#X setfilter 0 0 1 0 0 1068. 17.445494 6.5922 0. 0. 0. 0. 0. 0.;
#X done;
#P user panel 590 589 289 187;
#X brgb 227 170 170;
#X frgb 0 0 0;
#X border 1;
#X rounded 0;
#X shadow 0;
#X done;
#P user gain~ 257 695 79 60 158 0 1.071519 7.94321 10.;
#P window setfont "Sans Serif" 12.;
#P window linecount 3;
#P comment 317 319 134 196620 this bit is to keep numbox from retriggering [coll];
#P window linecount 2;
#P comment 367 99 181 196620 use me for live control or for storing a preset in [coll];
#P window setfont "Sans Serif" 9.;
#P window linecount 1;
#P comment 326 537 105 196617 load/save your work;
#P message 394 555 35 196617 write;
#P message 361 555 30 196617 read;
#P newex 438 540 45 196617 prepend;
#P newex 438 503 62 196617 prepend set;
#P newex 421 475 27 196617 t b i;
#P newex 458 474 83 196617 value $1-coeffs;
#P comment 359 390 55 196617 WRITE;
#P button 344 388 15 0;
#P comment 359 372 55 196617 READ;
#P button 344 370 15 0;
#P newex 421 441 27 196617 i;
#P newex 321 441 27 196617 i;
#P comment 372 417 55 196617 data index;
#P number 338 416 35 9 0 0 0 3 0 0 0 221 221 221 222 222 222 0 0 0;
#P number 452 601 35 9 0 0 0 3 0 0 0 221 221 221 222 222 222 0 0 0;
#N coll ;
#P newobj 438 578 53 196617 coll;
#P newex 257 648 39 196617 noise~;
#P message 252 593 27 196617 stop;
#P message 180 593 65 196617 startwindow;
#P newex 213 759 30 196617 dac~;
#P newex 257 674 51 196617 cascade~;
#P comment 489 603 55 196617 data index;
#P window setfont Helvetica 9.;
#P user filtergraph~ 298 140 256 128 21 9 20. 20000. 0.0625 16. 0 1 1 0 0 1 1;
#X frgb 170 170 170;
#X brgb 209 209 209;
#X rgb2 0 0 0;
#X rgb3 130 130 130;
#X rgb4 0 0 0;
#X rgb5 76 108 172;
#X rgb6 210 74 54;
#X rgb7 255 22 22;
#X linmarkers 5512.5 11025. 16537.5;
#X logmarkers 10. 100. 1000. 10000.;
#X nfilters 3;
#X setfilter 2 3 1 0 0 61.670284 172.597748 9.26696 0. 0. 0. 0. 0. 0.;
#X setfilter 1 3 1 0 0 266.053253 10.382491 5.333812 0. 0. 0. 0. 0. 0.;
#X setfilter 0 3 1 0 0 3019.730713 5.91721 4.916065 0. 0. 0. 0. 0. 0.;
#X done;
#P user panel 281 86 290 196;
#X brgb 193 206 254;
#X frgb 0 0 0;
#X border 1;
#X rounded 0;
#X shadow 0;
#X done;
#P user panel 312 313 144 150;
#X brgb 246 223 255;
#X frgb 0 0 0;
#X border 1;
#X rounded 0;
#X shadow 0;
#X done;
#P connect 28 0 5 0;
#P fasten 6 0 5 0 185 634 218 634;
#P fasten 7 0 5 0 257 634 218 634;
#P connect 28 0 5 1;
#P connect 8 0 4 0;
#P connect 4 0 28 0;
#P fasten 9 0 4 1 443 647 303 647;
#P lcolor 10;
#P fasten 2 0 4 1 303 293 303 293 303 326 303 326;
#P fasten 15 0 13 0 326 385;
#P connect 11 0 13 1;
#P lcolor 7;
#P fasten 17 0 14 0 349 409 426 409;
#P fasten 14 0 20 0 426 472 426 472;
#P fasten 11 0 14 1 343 434 443 434;
#P lcolor 8;
#P connect 20 1 21 0;
#P connect 21 0 22 0;
#P fasten 19 0 22 0 463 495 541 495 541 527 443 527;
#P lcolor 12;
#P connect 22 0 9 0;
#P lcolor 12;
#P fasten 13 0 9 0 326 577 443 577;
#P connect 24 0 9 0;
#P connect 23 0 9 0;
#P connect 9 1 10 0;
#P fasten 2 0 19 0 303 293 440 293 440 293 463 293 463 461 463 461;
#P lcolor 12;
#P fasten 20 0 19 0 426 496 454 496 454 469 463 469;
#P lcolor 4;
#P fasten 9 0 30 0 443 626 612 626;
#P lcolor 10;
#P window clipboard copycount 32;


April 1, 2008 | 4:03 am

Quote: Roth wrote on Sat, 29 March 2008 00:34
—————————————————-
> It is too bad we don’t have access to [filtergraph~] with [pattr] because it would really be cool to crossfade between different filter setups with [pattrstorage].

You can crossfade between different filter settings with pattrstorage. If an object doesn’t directly work with the pattr system, just send the data into a [pattr] object (see patch below).

My biggest complaint with this approach is I only want to use a single filtergraph~ and send the pattr output back into that same filtergraph. But cascaded filters only work in display mode. I thought immediately after sending a list into the [filtergraph~] I could send the appropriate options messages (like "options 0 3 1 0 0", "options 1 3 1 0 0", etc) to get it back out of display mode. But when I tried this, filtergraph starting acting all buggy and it crashed Max a few times before I gave up.

But yeah, it would be much better for filtergraph to directly support the pattr system. Maybe in Max 5?

#P user multiSlider 527 160 121 21 1. 2. 1 2680 47 0 0 2 0 0 0;
#M frgb 0 0 0;
#M brgb 255 255 255;
#M rgb2 127 127 127;
#M rgb3 0 0 0;
#M rgb4 37 52 91;
#M rgb5 74 105 182;
#M rgb6 112 158 18;
#M rgb7 149 211 110;
#M rgb8 187 9 201;
#M rgb9 224 62 37;
#M rgb10 7 114 128;
#P window setfont "Sans Serif" 9.;
#P window linecount 1;
#P message 508 126 43 196617 store 2;
#P message 450 124 43 196617 store 1;
#P newex 450 195 67 196617 pattrstorage;
#X client_rect 0 0 640 240;
#X storage_rect 0 0 640 240;
#P objectname u724000002;
#P newex 134 267 94 196617 pattr @name filter;
#X prestore 15 0 0.168454 0. -0.168454 -1.542077 0.893722 0.132671 0. -0.132671 -1.930287 0.933739 0.081785 0. -0.081785 -1.998975 0.999052;
#P objectname filter;
#P window setfont Helvetica 9.;
#P user filtergraph~ 217 341 256 128 21 9 20. 20000. 0.0625 16. 0 1 1 0 0 1 1;
#X frgb 170 170 170;
#X brgb 209 209 209;
#X rgb2 0 0 0;
#X rgb3 130 130 130;
#X rgb4 0 0 0;
#X rgb5 76 108 172;
#X rgb6 210 74 54;
#X rgb7 255 22 22;
#X linmarkers 5512.5 11025. 16537.5;
#X logmarkers 10. 100. 1000. 10000.;
#X nfilters 3;
#X setfilter 2 0 1 0 0 187.640213 13.458423 9.26696 0. 0. 0. 0. 0. 0.;
#X setfilter 1 0 1 0 0 678.533997 11.320516 5.333812 0. 0. 0. 0. 0. 0.;
#X setfilter 0 0 1 0 0 1068. 17.445494 6.5922 0. 0. 0. 0. 0. 0.;
#X done;
#P user panel 200 299 289 187;
#X brgb 227 170 170;
#X frgb 0 0 0;
#X border 1;
#X rounded 0;
#X shadow 0;
#X done;
#P user gain~ 93 341 79 60 158 0 1.071519 7.94321 10.;
#P window setfont "Sans Serif" 9.;
#P newex 93 294 39 196617 noise~;
#P message 88 239 27 196617 stop;
#P message 16 239 65 196617 startwindow;
#P newex 48 446 30 196617 dac~;
#P newex 93 320 51 196617 cascade~;
#P window setfont Helvetica 9.;
#P user filtergraph~ 134 65 256 128 21 9 20. 20000. 0.0625 16. 0 1 1 0 0 1 1;
#X frgb 170 170 170;
#X brgb 209 209 209;
#X rgb2 0 0 0;
#X rgb3 130 130 130;
#X rgb4 0 0 0;
#X rgb5 76 108 172;
#X rgb6 210 74 54;
#X rgb7 255 22 22;
#X linmarkers 5512.5 11025. 16537.5;
#X logmarkers 10. 100. 1000. 10000.;
#X nfilters 3;
#X setfilter 2 3 1 0 0 61.670284 172.597748 9.26696 0. 0. 0. 0. 0. 0.;
#X setfilter 1 3 1 0 0 419.45871 3.839352 0.428145 0. 0. 0. 0. 0. 0.;
#X setfilter 0 3 1 0 0 5571.841797 1.246274 4.916065 0. 0. 0. 0. 0. 0.;
#X done;
#P user panel 117 29 290 196;
#X brgb 193 206 254;
#X frgb 0 0 0;
#X border 1;
#X rounded 0;
#X shadow 0;
#X done;
#P window setfont "Sans Serif" 9.;
#P window linecount 2;
#P comment 555 131 96 196617 interpolate from preset 1 to 2;
#P connect 8 0 4 0;
#P connect 8 0 4 1;
#P connect 11 0 3 1;
#P connect 11 0 10 0;
#P connect 2 0 11 0;
#P connect 15 0 12 0;
#P connect 13 0 12 0;
#P connect 14 0 12 0;
#P connect 3 0 8 0;
#P connect 7 0 3 0;
#P fasten 6 0 4 0 93 280 53 280;
#P fasten 5 0 4 0 21 280 53 280;
#P window clipboard copycount 16;


April 1, 2008 | 6:34 am

I guess I should have phrased my [pattr] wishes that it would some how magically interpolate between lists of different lengths to crossfade between cascaded filters where the number of filters used in [filtergraph~] changes between presets.

I got so caught working out methods for managing this (and then just suggesting the [coll] solution since my students piece is coming up and since he was familiar with [coll] and not [pattr] I figured he’d be best not tackling new objects right before a performance) that I completely overlooked trying to use [pattr] in that way with [filtergraph~].

Thanks for reminding me Adam! :)

P.S. Not sure exactly how the forum/list integration works, so sorry if fixing my typo sent this out to the list twice.


April 1, 2008 | 6:07 pm

On 1 avr. 08, at 06:03, Adam Murray wrote:

> Maybe in Max 5?


Yep.

ej


Viewing 8 posts - 1 through 8 (of 8 total)