Filter envelope with biquad?

Nov 10, 2008 at 1:25am

Filter envelope with biquad?

Can anyone give me some hints on how to add an envelope to a biquad filter, or more specifically, a biquad fronted by a filtergraph object?

I suspect it is not possible, but if anyone has any hints (I am not asking for someone to create the patch for me, just a noob looking for the start of the trail).

Thanks

Ed

#40756
Nov 10, 2008 at 2:42am

Are you trying to use an envelope to control the centre frequency (or gain or Q) of your filter? If so you can use [function] sent to [line~] then to [filtercoeff~] into [biquad]. Below is a very simple example. I hope it helps.

lh

– Pasted Max Patch, click to expand. –
#144525
Nov 10, 2008 at 6:52pm

If you want to envelope a specific parameter, go with the method described above. This may be what you are after I think, but if it isn’t, something else you can do is use the pattr objects to cross-fade between filtergraphs. Check out this thread:

http://www.cycling74.com/forums/index.php?t=msg&goto=135502&rid=4220&S=cb43e8c8e8f30e94d9a864e79a5412c9

#144526
Nov 12, 2008 at 7:25am

Hey guys, thanks for the quick replies (I feel guilty I didn’t respond quickly because of work stealing my max/msp time).

Both examples were very helpful and got me thinking enough that I felt comfortable I could do what I wanted but then as I started plodding along coding it, I realized I was completely wrong and my approach would never work.

What I was planning on doing was creating a filter that had an envelope, but an envelope initiated by a midi note, not something acting on a constant signal. I was looking for something along the lines of the adsr, in the sense that I needed something that would be sample accurate so it could act when a signal is greater then 0, modify the cutoff or Q of the filtergraph (which acting as the input to a biquad). After pouring over the filter graph and biquad docs (and everything in the max documentation I could think of) I am starting to think it is not possible because I cannot figure out how to plug the adsr into the filtergraph and/or biquad.

Any thoughts? (I have attempted to search the archives but I couldn’t find anything or there is just too much information to scan).

#144527
Nov 12, 2008 at 7:45am

Can’t figure it out is one thing, but since Max is a programming environment, “impossible” shouldn’t be in your vocabulary :)

I made a little non-functional example to illustrate what you could do. Just replace the [sig~] objects with your envelope generator. [+~] objects can be used instead of the [*~] objects depending if you want to shift or scale the values from the [filtergraph].

Good luck!

– Pasted Max Patch, click to expand. –
#144528
Nov 14, 2008 at 11:59am

emajcher schrieb:
> What I was planning on doing was creating a filter that had an
> envelope, but an envelope initiated by a midi note, not something
> acting on a constant signal. I was looking for something along the
> lines of the adsr, in the sense that I needed something that would be
> sample accurate so it could act when a signal is greater then 0,
> modify the cutoff or Q of the filtergraph (which acting as the input
> to a biquad). After pouring over the filter graph and biquad docs
> (and everything in the max documentation I could think of) I am
> starting to think it is not possible because I cannot figure out how
> to plug the adsr into the filtergraph and/or biquad.

Don’t give up, I can assure you its possible. If you insist on audio
domain control (I don’t see the need) you need to use filtercoeff~ for
controlling the cascade~. You might want to control the frequency
exponetially with the aid of mtof~…
As amplitude envelopes always start and go to zero, you might consider
an offset as well, as your filter envelope needs a different range…

Stefan


Stefan Tiedje————x——-
–_____———–|————–
–(_|_ —-|—–|—–()——-
– _|_)—-|—–()————–
———-()——–www.ccmix.com

#144529
Nov 24, 2008 at 4:11am

ok, long overdue on a response here, but i was busy with programming silly web applications to pay the bills. i think i got it, so i thought i would post my solution for the sake of posterity (and to prove i didn’t give up).

i know the patch isn’t perfect, you can get hanging notes from the sustain getting superseded by another note, but that is a detail, the real goal was an envelope controlled filter via biquad. i ended up abandoning the ADSR object and going straight from a function. in the end … i am not 100% sure why it works since i don’t understand how the filter envelope will get triggered at the appropriate time in sync with the amp envelope instead of before or after it. this is my one problem with max, the concept of when events get triggered.

anyway …

– Pasted Max Patch, click to expand. –

Ed

#144530
Nov 24, 2008 at 4:12am

ok, long overdue on a response here, but i was busy with programming silly web applications to pay the bills. i think i got it, so i thought i would post my solution for the sake of posterity (and to prove i didn’t give up).

i know the patch isn’t perfect, you can get hanging notes from the sustain getting superseded by another note, but that is a detail, the real goal was an envelope controlled filter via biquad. i ended up abandoning the ADSR object and going straight from a function. in the end … i am not 100% sure why it works since i don’t understand how the filter envelope will get triggered at the appropriate time in sync with the amp envelope instead of before or after it. this is my one problem with max, the concept of when events get triggered.

anyway …

– Pasted Max Patch, click to expand. –

Ed

#144531
Dec 17, 2008 at 12:26am

hope it helps!!

max v2;
#N vpatcher 189 230 881 801;
#P window setfont “Sans Serif” 9.;
#P newex 192 109 37 196617 r freq;
#P hidden message 34 354 23 196617 0.7;
#P hidden message 472 59 26 196617 750;
#P hidden message 437 59 17 196617 0.9;
#P hidden message 402 59 31 196617 750.;
#P hidden message 367 59 31 196617 500.;
#P hidden newex 350 24 48 196617 loadbang;
#P comment 481 91 15 196617 R;
#P comment 448 90 15 196617 S;
#P comment 414 89 15 196617 D;
#P flonum 472 112 35 9 0 0 0 3 0 0 0 221 221 221 222 222 222 0 0 0;
#P flonum 437 112 35 9 0 0 0 3 0 0 0 221 221 221 222 222 222 0 0 0;
#P flonum 402 112 35 9 0 0 0 3 0 0 0 221 221 221 222 222 222 0 0 0;
#P flonum 367 112 35 9 0 0 0 3 0 0 0 221 221 221 222 222 222 0 0 0;
#P flonum 35 373 35 9 0 0 0 3 0 0 0 221 221 221 222 222 222 0 0 0;
#P newex 4 396 41 196617 *~ 0.1;
#P message 57 397 29 196617 stop;
#P message 91 397 67 196617 startwindow;
#P newex 4 431 31 196617 dac~;
#P newex 382 214 37 196617 s freq;
#P user number~ 353 189 392 204 9 3 3 2 0. 0. 0 0. 250 0. 0 0 0 221 221 221 222 222 222 0 0 0;
#P newex 353 163 66 196617 adsr~;
#P message 331 139 14 196617 0;
#P newex 331 112 32 196617 sel 0;
#P newex 192 133 31 196617 mtof;
#P newex 192 180 40 196617 line;
#P message 192 158 46 196617 $1 200.;
#P message 17 181 46 196617 lowpass;
#P window setfont Helvetica 9.;
#P user filtergraph~ 17 203 256 128 21 9 20. 22050. 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 1;
#X setfilter 0 1 1 0 0 20. 1. 0.5 20. 22050. 1. 1.122462 0.5 25.;
#X done;
#P window setfont “Sans Serif” 9.;
#P newex 4 335 79 196617 biquad~;
#P newex 66 149 55 196617 saw~ 442;
#P newex 4 112 31 196617 mtof;
#P user kslider 4 48 54 0 36 48 31 12 1 128 128 128 128 128 128 255 255 255 0 0 0 0 0 0;
#P newex 4 149 55 196617 saw~ 440;
#P comment 377 88 15 196617 A;
#P connect 2 0 3 0;
#P connect 3 0 1 0;
#P connect 1 0 5 0;
#P fasten 4 0 5 0 71 173 9 173;
#P connect 5 0 19 0;
#P connect 19 0 16 0;
#P fasten 18 0 16 0 62 421 9 421;
#P fasten 17 0 16 0 96 421 9 421;
#P hidden connect 28 0 7 0;
#P connect 7 0 6 0;
#P connect 6 0 5 1;
#P fasten 19 0 16 1 9 425 30 425;
#P hidden connect 28 0 33 0;
#P hidden connect 33 0 20 0;
#P connect 20 0 19 1;
#P fasten 3 0 4 0 9 139 71 139;
#P hidden connect 28 0 17 0;
#P connect 34 0 10 0;
#P connect 10 0 8 0;
#P connect 8 0 9 0;
#P connect 9 0 6 5;
#P connect 2 1 11 0;
#P connect 11 0 12 0;
#P connect 12 0 13 0;
#P connect 11 1 13 0;
#P connect 13 0 14 0;
#P hidden connect 28 0 29 0;
#P hidden connect 29 0 21 0;
#P connect 21 0 13 1;
#P fasten 22 0 13 2 407 145 386 145;
#P connect 14 1 15 0;
#P fasten 23 0 13 3 442 145 400 145;
#P hidden connect 28 0 30 0;
#P hidden connect 30 0 22 0;
#P fasten 24 0 13 4 477 145 414 145;
#P hidden connect 28 0 31 0;
#P hidden connect 31 0 23 0;
#P hidden connect 28 0 32 0;
#P hidden connect 32 0 24 0;
#P pop;

#144532
Dec 17, 2008 at 4:40am

A suggestion:

– Pasted Max Patch, click to expand. –

hope you like it,
you can also control the

best,
sophocles

http://www.myspace.com/sophoclesarvanitis

#144533
Dec 17, 2008 at 4:41am

the Q i mean sorry.

#144534

You must be logged in to reply to this topic.