#N canvas 920 581 1407 592 10; #X obj 105 111 inlet; #X obj 435 151 inlet; #X text 101 86 trigger; #X obj 105 139 sel 0; #X obj 244 155 t b; #X obj 166 264 f \$1; #X obj 166 289 pack 0 \$2; #X obj 492 151 inlet; #X obj 438 281 del \$2; #X obj 458 429 line~; #X obj 462 304 f \$4; #X obj 501 379 pack 0 \$3; #X obj 554 151 inlet; #X obj 616 151 inlet; #X obj 689 150 inlet; #X msg 105 170 stop; #X obj 612 306 pack 0 \$5; #X text 435 129 level; #X obj 501 355 * \$1; #X obj 458 454 outlet~; #X text 102 378 and pack with; #X text 103 398 attack time; #X text 31 126 if zero; #X text 32 143 release; #X text 12 160 and cancel; #X text 43 177 decay; #X text 284 272 on attack \, set a; #X text 278 305 recall sustain value; #X text 315 378 pack with decay time; #X obj 462 329 * 0.01; #X text 13 2 ADSR ENVELOPE; #X text 488 129 attack; #X text 555 128 decay; #X text 609 129 sustain; #X text 686 129 release; #X text 202 71 attack; #X obj 204 92 moses; #X obj 194 122 t b b; #X msg 128 290 0; #X text 20 273 optionally; #X text 10 291 bash to zero; #X text 25 246 ATTACK:; #X text 255 89 test for negative trigger; #X text 253 113 if so \, zero; #X text 254 129 the output; #X text 278 165 in any case; #X text 303 355 multiply by peak level; #X text 280 286 delay for sustain; #X text 276 328 convert from percent; #X text 155 340 ... then; #X text 103 359 recall peak level; #X text 439 113 peak; #X text 281 149 ... do this; #X text 208 1 Arguments: level \, attack time \, decay time \, sustain level \, release time. A \, D \, and R are in msec and S is in percent. This patch is used as an abstraction in various examples.; #X connect 0 0 3 0; #X connect 1 0 5 1; #X connect 1 0 18 1; #X connect 3 0 15 0; #X connect 3 0 16 0; #X connect 3 1 36 0; #X connect 4 0 5 0; #X connect 4 0 8 0; #X connect 5 0 6 0; #X connect 6 0 9 0; #X connect 7 0 6 1; #X connect 7 0 8 1; #X connect 8 0 10 0; #X connect 9 0 19 0; #X connect 10 0 29 0; #X connect 11 0 9 0; #X connect 12 0 11 1; #X connect 13 0 10 1; #X connect 14 0 16 1; #X connect 15 0 8 0; #X connect 16 0 9 0; #X connect 18 0 11 0; #X connect 29 0 18 0; #X connect 36 0 37 0; #X connect 36 1 4 0; #X connect 37 0 4 0; #X connect 37 1 38 0; #X connect 38 0 9 0;