Breakoint envelopes

Jan 26, 2008 at 8:59pm

Breakoint envelopes

I am trying to build an additive synth with 16 oscilators, each having its own amplitude envelope.

I wish to eliminate having 16 envelopes on the interface so was wondeing if there was a way to have a master envelope that could be assigned to a particular oscilator, while using a …preset?… to save the previous oscilators envelope settings to be recalled when the oscilator was next selected??

This would require the oscilators particular envelope to mirror the master one when the required message was sent. It would also require the master envelope to revert to the selected oscilators precviously saved settings when that osc was subsequently selected.???

It occured to me there may be a way of using poly to achieve this?

#35531
Jan 26, 2008 at 11:13pm

interesting.

#121234
Jan 27, 2008 at 4:38pm

is this what you mean?

I’m sure there’s a less kuldgy way to do this. But I built a patch
recently, three sets of four oscillators, and I ran into a similar
situation. I wanted to set the envelope of all (or a subset of) the
envelopes.

anyway,
here’s what I came up with (all in one patcher window–master and two
[functions] tied to it.

best
Sam

——————-

#P window setfont Verdana 10.;
#P window linecount 1;
#P comment 420 48 63 472055818 module 2;
#P comment 138 50 63 472055818 module 1;
#P number 536 125 45 10 0 0 0 7203 0 0 0 221 221 221 222 222 222 0 0 0;
#P number 232 125 45 10 0 0 0 7203 0 0 0 221 221 221 222 222 222 0 0 0;
#P newex 536 85 60 472055818 r setdmn;
#P newex 232 86 60 472055818 r setdmn;
#P newex 477 121 48 472055818 r func2;
#P newex 374 89 61 472055818 autopattr;
#X prestore table04[1] 128 0 0 0 0 0 0 0 0 0 76 76 77 77 77 77 77 77
77 77 77 77 77 77 77 77 77 77 77 77 77 75 73 70 68 66 64 62 59 57 54 52;
#X prestore table04[1] 128 40 50 49 47 46 44 42 41 39 38 36 35 33 31
28 26 23 20 12 8 6 5 4 3 2 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0;
#X prestore table04[1] 128 80 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0;
#X prestore table04[1] 128 120 0 0 0 0 0 0 0 0;
#P objectname u971000081;
#P window linecount 2;
#P comment 456 210 111 472055818 bang/dur. creates amp. env.;
#P outlet 455 188 15 0;
#P outlet 344 188 15 0;
#P inlet 344 93 15 0;
#P button 455 124 15 0;
#P window linecount 1;
#N vpatcher 184 550 581 830;
#P window setfont Verdana 10.;
#P newex 182 85 61 472055818 autopattr;
#X prestore breakpoint04 30 0 1112. 0. 1. 0. 0. 0 35.27644 0.242424 0
82.311531 0.909091 0 90.150658 0.5 0 145.025208 0.287879 0 192.060501
0.863636 0 350.803925 0.757576 0 482.111267 0.106061 0 538.944824 0. 0;
#P objectname u378000082;
#P message 77 79 87 472055818 setdomain $1;
#P number 77 55 54 10 0 0 0 7203 0 0 0 221 221 221 222 222 222 0 0 0;
#P user function 77 118 364 209 1 1 0 0;
#X frgb 82 82 82;
#X brgb 204 204 204;
#X rgb2 85 85 85;
#X rgb3 255 255 255;
#X rgb4 0 0 0;
#X rgb5 0 0 0;
#X add 0. 0. 0;
#X add 35.27644 0.242424 0;
#X add 82.311531 0.909091 0;
#X add 90.150658 0.5 0;
#X add 145.025208 0.287879 0;
#X add 192.060501 0.863636 0;
#X add 350.803925 0.757576 0;
#X add 482.111267 0.106061 0;
#X add 538.944824 0. 0;
#X domain 1112.;
#X range 0. 1.;
#X done;
#P objectname breakpoint04;
#P comment 44 33 32 472055818 dur.;
#P window linecount 2;
#P comment 189 220 107 472055818 outputs all points in line format;
#P window linecount 1;
#P comment 132 56 31 472055818 ms.;
#P comment 14 86 38 472055818 bang;
#P inlet 77 33 15 0;
#P inlet 54 86 15 0;
#P outlet 169 214 15 0;
#P connect 2 0 8 0;
#P connect 8 0 9 0;
#P fasten 1 0 7 0 59 113 82 113;
#P connect 9 0 7 0;
#P connect 10 0 7 0;
#P connect 7 1 0 0;
#P pop 1;
#P newobj 455 151 86 472055818 p functionTwo;
#P objectname “sub patch[1]“;
#P flonum 344 151 35 10 0 0 0 7203 0 0 0 221 221 221 222 222 222 0 0 0;
#N vtable 128 20 74 230 241 0 128 2.t;
#P newobj 344 124 57 472055818 table 2.t;
#P objectname table04[1];
#P window linecount 3;
#P comment 344 209 80 472055818 bang selects partial ; sends out;
#P window linecount 1;
#P newex 814 89 62 472055818 loadbang;
#P window linecount 4;
#P comment 676 78 133 472055818 bang sets all env. in module to “mass
env control’s” envelope shape…;
#P number 783 136 40 10 0 0 0 7203 0 0 0 221 221 221 222 222 222 0 0 0;
#P button 677 136 15 0;
#P window linecount 1;
#N vpatcher 447 363 1102 867;
#P inlet 226 74 15 0;
#P inlet 392 78 15 0;
#P outlet 387 378 15 0;
#P window setfont Verdana 10.;
#P newex 481 125 62 472055818 s setdmn;
#P number 391 100 48 10 0 0 0 7203 0 0 0 221 221 221 222 222 222 0 0 0;
#P message 391 126 87 472055818 setdomain $1;
#P newex 261 117 45 472055818 del 10;
#P button 353 293 15 0;
#P message 353 335 36 472055818 clear;
#P message 335 128 36 472055818 clear;
#P message 261 143 42 472055818 dump;
#P button 226 94 15 0;
#P user function 261 183 548 274 1 1 0 0;
#X frgb 82 82 82;
#X brgb 204 204 204;
#X rgb2 85 85 85;
#X rgb3 255 255 255;
#X rgb4 0 0 0;
#X rgb5 0 0 0;
#X add 0. 0. 0;
#X add 72.785538 0.242424 0;
#X add 169.832779 0.909091 0;
#X add 186.007248 0.5 0;
#X add 299.229034 0.287879 0;
#X add 396.276733 0.863636 0;
#X add 723.811157 0.757576 0;
#X add 994.736206 0.106061 0;
#X add 1112. 0. 0;
#X domain 1112.;
#X range 0. 1.;
#X done;
#P objectname breakpoint01;
#P comment 31 96 187 472055818 click button to set all envelopes;
#P connect 13 0 2 0;
#P connect 2 0 7 0;
#P connect 7 0 3 0;
#P connect 2 0 1 0;
#P connect 3 0 1 0;
#P connect 4 0 1 0;
#P connect 8 0 1 0;
#P connect 1 1 6 0;
#P connect 6 0 5 0;
#P connect 1 2 11 0;
#P connect 5 0 11 0;
#P connect 12 0 9 0;
#P connect 9 0 8 0;
#P connect 9 0 10 0;
#P pop;
#P newobj 677 162 116 472055818 p mass env control;
#P newex 714 202 50 472055818 s func2;
#P newex 653 202 50 472055818 s func1;
#P window linecount 3;
#P comment 823 114 92 472055818 change dur. of all notes in this module;
#P user panel 645 71 277 162;
#X brgb 231 231 231;
#X frgb 0 0 0;
#X border 0;
#X rounded 0;
#X shadow 0;
#X done;
#P window linecount 1;
#P newex 175 122 48 472055818 r func1;
#P newex 72 90 61 472055818 autopattr;
#X prestore table04 128 0 0 0 0 0 0 0 0 0 0 0 0 0 59 65 70 73 75 76
77 77 78 78 78 79 79 80 80 80 81 81 82 82 82 82 82 82 81 80 79 79;
#X prestore table04 128 40 78 76 74 72 70 68 66 63 61 58 55 52 50 48
46 42 38 35 31 28 24 21 18 15 12 9 7 5 3 2 1 0 0 0 0 0 0 0 0 0;
#X prestore table04 128 80 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0;
#X prestore table04 128 120 0 0 0 0 0 0 0 0;
#P objectname u206000057;
#P window linecount 2;
#P comment 154 211 111 472055818 bang/dur. creates amp. env.;
#P outlet 153 189 15 0;
#P outlet 42 189 15 0;
#P inlet 42 94 15 0;
#P button 153 125 15 0;
#P window linecount 1;
#N vpatcher 586 563 983 843;
#P window setfont Verdana 10.;
#P newex 182 85 61 472055818 autopattr;
#X prestore breakpoint04 30 0 1112. 0. 1. 0. 0. 0 35.27644 0.242424 0
82.311531 0.909091 0 90.150658 0.5 0 145.025208 0.287879 0 192.060501
0.863636 0 350.803925 0.757576 0 482.111267 0.106061 0 538.944824 0. 0;
#P objectname u901000059;
#P message 77 79 87 472055818 setdomain $1;
#P number 77 55 54 10 0 0 0 7203 0 0 0 221 221 221 222 222 222 0 0 0;
#P user function 77 118 364 209 1 1 0 0;
#X frgb 82 82 82;
#X brgb 204 204 204;
#X rgb2 85 85 85;
#X rgb3 255 255 255;
#X rgb4 0 0 0;
#X rgb5 0 0 0;
#X add 0. 0. 0;
#X add 35.27644 0.242424 0;
#X add 82.311531 0.909091 0;
#X add 90.150658 0.5 0;
#X add 145.025208 0.287879 0;
#X add 192.060501 0.863636 0;
#X add 350.803925 0.757576 0;
#X add 482.111267 0.106061 0;
#X add 538.944824 0. 0;
#X domain 1112.;
#X range 0. 1.;
#X done;
#P objectname breakpoint04;
#P comment 44 33 32 472055818 dur.;
#P window linecount 2;
#P comment 189 220 107 472055818 outputs all points in line format;
#P window linecount 1;
#P comment 132 56 31 472055818 ms.;
#P comment 14 86 38 472055818 bang;
#P inlet 77 33 15 0;
#P inlet 54 86 15 0;
#P outlet 169 214 15 0;
#P connect 2 0 8 0;
#P connect 8 0 9 0;
#P connect 10 0 7 0;
#P connect 9 0 7 0;
#P fasten 1 0 7 0 59 113 82 113;
#P connect 7 1 0 0;
#P pop 1;
#P newobj 153 152 88 472055818 p functionOne;
#P objectname “sub patch”;
#P flonum 42 152 35 10 0 0 0 7203 0 0 0 221 221 221 222 222 222 0 0 0;
#N vtable 128 20 74 230 241 0 128 1.t;
#P newobj 42 125 57 472055818 table 1.t;
#P objectname table04;
#P window linecount 3;
#P comment 42 210 80 472055818 bang selects partial ; sends out;
#P user panel 331 70 273 191;
#X brgb 231 231 231;
#X frgb 0 0 0;
#X border 0;
#X rounded 0;
#X shadow 0;
#X done;
#P user panel 28 71 273 191;
#X brgb 231 231 231;
#X frgb 0 0 0;
#X border 0;
#X rounded 0;
#X shadow 0;
#X done;
#P window linecount 1;
#P comment 718 50 47 472055818 control;
#P connect 8 0 4 0;
#P connect 12 0 4 0;
#P connect 4 0 5 0;
#P connect 5 0 9 0;
#P fasten 8 0 7 0 47 116 158 116;
#P connect 13 0 6 0;
#P connect 7 0 6 0;
#P connect 6 0 10 0;
#P connect 36 0 6 1;
#P connect 34 0 36 0;
#P connect 28 0 24 0;
#P connect 32 0 24 0;
#P connect 24 0 25 0;
#P connect 25 0 29 0;
#P fasten 28 0 27 0 349 115 460 115;
#P connect 33 0 26 0;
#P connect 27 0 26 0;
#P connect 26 0 30 0;
#P connect 37 0 26 1;
#P connect 35 0 37 0;
#P connect 18 0 16 0;
#P connect 19 0 18 0;
#P connect 18 0 17 0;
#P connect 22 0 20 0;
#P connect 20 0 18 1;
#P window clipboard copycount 40;

On Jan 26, 2008, at 12:59 PM, seanzshow wrote:

>
> I am trying to build an additive synth with 16 oscilators, each
> having its own amplitude envelope.
>
> I wish to eliminate having 16 envelopes on the interface so was
> wondeing if there was a way to have a master envelope that could be
> assigned to a particular oscilator, while using a …preset?… to
> save the previous oscilators envelope settings to be recalled when
> the oscilator was next selected??
>
> This would require the oscilators particular envelope to mirror the
> master one when the required message was sent. It would also
> require the master envelope to revert to the selected oscilators
> precviously saved settings when that osc was subsequently selected.???
>
> It occured to me there may be a way of using poly to achieve this?

#121235
Jan 29, 2008 at 3:42am

Quote: seanzshow@hotmail.com wrote on Sat, 26 January 2008 12:59
—————————————————-
> I am trying to build an additive synth with 16 oscilators, each having its own amplitude envelope.
>
> I wish to eliminate having 16 envelopes on the interface so was wondeing if there was a way to have a master envelope that could be assigned to a particular oscilator
>
>…
>
> It occured to me there may be a way of using poly to achieve this?
—————————————————-

This is a perfect job for poly~ and the pattr system. The tricky part is detaching your interface from the logic. I’m assuming you want to use the function object for the interface. So you need to be able to (1) get your envelope out of the function object and store it in a pattr and (2) get your envelope out of the pattr and put it back in the function. (1) is no problem – function outputs in line~ format and a pattr object will store the list of numbers. (2) is trickier, so see my patch below. The rest is standard poly~ and pattr operations.

I have patches that do stuff like this so I pruned it down to a simple(?) example. There is a 16 voice poly, and each poly instance takes a base frequency and multiplies it by the voice number to give you a harmonic series (the 16th voice is 16*base frequency).

Save this as “polyenvtest”:

#P window setfont “Sans Serif” 9.;
#P window linecount 1;
#P newex 138 148 29 196617 * 1.;
#P newex 157 41 48 196617 loadbang;
#P newex 157 90 52 196617 thispoly~;
#P newex 41 68 79 196617 route bang freq;
#P newex 91 228 27 196617 *~;
#P newex 138 187 40 196617 cycle~;
#P newex 41 156 36 196617 zl reg;
#P newex 41 186 32 196617 line~;
#N in 1;
#P newobj 41 38 25 196617 in 1;
#N out~ 1;
#P newobj 91 252 39 196617 out~ 1;
#P newex 67 105 52 196617 pattr env;
#X prestore 1 0 0;
#P objectname env;
#P newex 41 105 20 196617 t b;
#P connect 9 0 11 1;
#P connect 10 0 9 0;
#P connect 11 0 6 0;
#P fasten 8 1 11 0 80 96 143 96;
#P connect 6 0 7 1;
#P connect 7 0 2 0;
#P connect 4 0 7 0;
#P connect 1 0 5 1;
#P connect 5 0 4 0;
#P connect 0 0 5 0;
#P connect 8 0 0 0;
#P connect 3 0 8 0;
#P window clipboard copycount 12;

Then open this patch and follow the instructions:

#P window setfont “Sans Serif” 9.;
#P window linecount 2;
#P comment 239 78 177 196617 3. Edit the envelope. The first point should always be (0 , 0);
#P comment 109 120 61 196617 2. Select a harmonic;
#P window linecount 1;
#P message 384 312 69 196617 clientwindow;
#P newex 45 111 30 196617 t b b;
#P button 45 82 23 0;
#N vpatcher 574 158 832 430;
#P window setfont “Sans Serif” 9.;
#P message 78 157 79 196617 1 1000 0 4000;
#P newex 44 107 31 196617 t b 1;
#P newex 75 81 27 196617 t b i;
#P newex 45 55 40 196617 uzi 16;
#P message 174 156 43 196617 0 5000;
#P inlet 45 35 15 0;
#P outlet 39 196 15 0;
#P outlet 174 192 15 0;
#P connect 6 1 1 0;
#P connect 5 1 1 0;
#P connect 4 1 6 0;
#P connect 2 0 4 0;
#P connect 4 2 5 0;
#P connect 6 0 7 0;
#P connect 5 0 3 0;
#P connect 7 0 0 0;
#P connect 3 0 0 0;
#P pop;
#P newobj 65 171 33 196617 p init;
#N vpatcher 20 74 356 420;
#P window setfont “Sans Serif” 9.;
#P window linecount 1;
#P message 83 110 55 196617 clear , 0 0;
#P newex 153 223 40 196617 append;
#P message 153 191 39 196617 set $1;
#P newex 151 143 29 196617 t b f;
#P message 223 102 33 196617 set 0;
#P newex 151 50 27 196617 t l b;
#P newex 151 117 64 196617 unpack 0. 0.;
#P newex 223 186 50 196617 accum 0.;
#P newex 151 93 55 196617 zl group 2;
#P window linecount 3;
#P comment 15 110 64 196617 assumes the function starts at 0 0;
#P inlet 151 30 15 0;
#P outlet 153 271 15 0;
#P connect 6 1 11 0;
#P connect 1 0 6 0;
#P connect 6 0 3 0;
#P connect 3 0 5 0;
#P connect 5 0 8 0;
#P connect 8 1 9 0;
#P fasten 4 0 10 0 228 216 158 216;
#P connect 9 0 10 0;
#P connect 10 0 0 0;
#P fasten 11 0 0 0 88 253 158 253;
#P connect 6 1 7 0;
#P connect 7 0 4 0;
#P fasten 8 0 4 0 156 177 228 177;
#P connect 5 1 4 1;
#P pop;
#P newobj 181 49 76 196617 p line2function;
#P newex 46 291 150 196617 sprintf getpolyenvtest.%i::env;
#P number 450 117 35 9 0 0 0 3 0 0 0 221 221 221 222 222 222 0 0 0;
#P button 580 103 34 0;
#P message 450 145 88 196617 target 0 , freq $1;
#P user meter~ 604 259 624 317 50 0 168 0 17 70 83 255 153 0 255 0 0 217 217 0 153 186 0 12 3 3 3 3;
#P user gain~ 580 259 24 36 158 10 1.071519 7.94321 10.;
#P user ezdac~ 580 315 624 348 1;
#P number 169 120 35 9 1 16 3 3 0 0 0 221 221 221 222 222 222 0 0 0;
#P objectname envindex;
#P newex 65 246 153 196617 sprintf set polyenvtest.%i::env;
#P newex 384 335 67 196617 pattrstorage;
#X client_rect 812 341 1452 581;
#X storage_rect 0 0 640 240;
#P objectname u578000004;
#P newex 580 214 106 196617 poly~ polyenvtest 16;
#P objectname polyenvtest;
#P newex 45 357 51 196617 zl slice 1;
#P newex 46 329 48 196617 pattrhub;
#P objectname u486000012;
#P newex 271 288 45 196617 prepend;
#P newex 208 76 20 196617 t b;
#P user function 208 104 408 204 1 1 0 0;
#X frgb 82 82 82;
#X brgb 204 204 204;
#X rgb2 85 85 85;
#X rgb3 255 255 255;
#X rgb4 0 0 0;
#X rgb5 0 0 0;
#X add 0. 0. 0;
#X add 4547.87207 0.413333 0;
#X add 5000. 0. 0;
#X domain 5000.;
#X range 0. 1.;
#X done;
#P window linecount 2;
#P comment 69 80 70 196617 1. Initialize the envelopes;
#P comment 450 88 72 196617 4. Pick a base frequency;
#P window linecount 1;
#P comment 583 88 77 196617 5. Play a note;
#P hidden connect 13 0 12 1;
#P hidden connect 13 0 14 0;
#P hidden connect 13 0 12 0;
#P connect 8 0 13 0;
#P connect 16 0 8 0;
#P connect 15 0 8 0;
#P connect 17 0 15 0;
#P connect 23 0 9 0;
#P connect 3 1 5 0;
#P fasten 10 0 5 0 70 275 276 275;
#P fasten 20 1 5 0 93 220 276 220;
#P connect 4 0 3 0;
#P fasten 19 0 3 0 186 99 213 99;
#P fasten 3 3 4 0 402 211 419 211 419 69 213 69;
#P fasten 7 1 19 0 91 384 34 384 34 43 186 43;
#P fasten 22 0 11 0 50 157 40 157 40 68 174 68;
#P fasten 11 0 18 0 174 199 51 199;
#P lcolor 10;
#P fasten 11 0 10 0 174 233 70 233;
#P lcolor 10;
#P connect 20 0 10 0;
#P connect 22 1 20 0;
#P fasten 5 0 6 0 276 317 51 317;
#P connect 18 0 6 0;
#P fasten 6 1 7 0 89 351 50 351;
#P connect 21 0 22 0;
#P window clipboard copycount 26;

Let me know if anything in there doesn’t make sense. This can use a lot of work but the basic idea should get your started. Good luck!

-Adam

#121236
Jan 29, 2008 at 2:36pm

Thanks Adam,

This is very clear and very helpful. I don’t need it right now but it is
definitely going into my toolbox.

Cheers
Gary Lee Nelson
Oberlin College
http://www.timara.oberlin.edu/GaryLeeNelson

On 1/28/08 10:42 PM, “Adam Murray” wrote:

> Let me know if anything in there doesn’t make sense. This can use a lot of
> work but the basic idea should get your started. Good luck!
>
> -Adam

#121237
Jan 29, 2008 at 4:27pm

Quote: adamj wrote on Tue, 29 January 2008 04:42
—————————————————-

>
> Let me know if anything in there doesn’t make sense. This can use a lot of work but the basic idea should get your started. Good luck!
>
> -Adam
—————————————————-

yes, beautifull patch Adam, thanks for sharing :)

#121238
Jan 30, 2008 at 11:07am

#121239

You must be logged in to reply to this topic.