#N canvas 351 82 872 651 12;
#X obj 129 120 inlet;
#X obj 438 160 inlet;
#X text 125 95 trigger;
#X obj 129 148 sel 0;
#X obj 190 273 f \$1;
#X obj 495 160 inlet;
#X obj 422 285 del \$2;
#X obj 595 476 line~;
#X obj 446 313 f \$4;
#X obj 545 160 inlet;
#X obj 600 160 inlet;
#X obj 656 160 inlet;
#X msg 129 179 stop;
#X obj 596 315 pack 0 \$5;
#X obj 485 364 * \$1;
#X obj 595 536 outlet~;
#X text 667 307 on release ramp;
#X text 668 324 back to zero;
#X obj 446 338 * 0.01;
#X text 122 35 ADSR ENVELOPE;
#X text 491 138 attack;
#X text 546 138 decay;
#X text 593 138 sustain;
#X text 653 138 release;
#X text 229 80 attack;
#X obj 231 101 moses;
#X obj 218 131 t b b;
#X msg 152 299 0;
#X text 58 266 ATTACK:;
#X text 596 582 Updated for Pd version 0.37;
#X text 279 98 test for negative trigger;
#X text 277 122 if so \, zero;
#X text 278 137 the output;
#X text 300 174 in any case;
#X text 303 158 ... do this;
#X text 105 515 Negative triggers cause the output to jump to zero and then attack (instead of attacking from the current location)., f 50;
#X text 343 20 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 text 309 374 multiply by peak level and pack with decay time, f 24;
#X text 292 281 on attack \, set a delay for sustain, f 17;
#X text 297 319 recall sustain value convert from percent, f 20;
#X text 58 290 optionally bash to zero, f 12;
#X text 664 476 generate envelope;
#X obj 263 164 b;
#X obj 190 298 pack f \$2;
#X obj 485 388 pack f \$3;
#X text 675 356 send to [line~];
#X obj 596 356 s \$0-line;
#X obj 485 419 s \$0-line;
#X text 367 420 send to [line~];
#X text 669 422 get attack \, decay and release lines, f 18;
#X obj 190 328 s \$0-line;
#X text 105 458 When you send this patch a positive trigger it schedules a [line~] to do an attack and decay \, and if zero \, it starts the release ramp., f 50;
#X text 105 568 Objects such as [f] and [pack] can be given dollar sign arguments to initialize their contents from [adsr]'s creation arguments. Inlets are supplied to change them on the fly., f 50;
#X text 41 135 if zero \, release and cancel decay, f 10;
#X text 27 327 then recall peak level and pack with attack time and send to [line~], f 24;
#X text 442 122 peak level, f 5;
#X obj 595 429 r \$0-line;
#X connect 0 0 3 0;
#X connect 1 0 4 1;
#X connect 1 0 14 1;
#X connect 3 0 12 0;
#X connect 3 0 13 0;
#X connect 3 1 25 0;
#X connect 4 0 43 0;
#X connect 5 0 6 1;
#X connect 5 0 43 1;
#X connect 6 0 8 0;
#X connect 7 0 15 0;
#X connect 8 0 18 0;
#X connect 9 0 44 1;
#X connect 10 0 8 1;
#X connect 11 0 13 1;
#X connect 12 0 6 0;
#X connect 13 0 46 0;
#X connect 14 0 44 0;
#X connect 18 0 14 0;
#X connect 25 0 26 0;
#X connect 25 1 42 0;
#X connect 26 0 42 0;
#X connect 26 1 27 0;
#X connect 27 0 50 0;
#X connect 42 0 4 0;
#X connect 42 0 6 0;
#X connect 43 0 50 0;
#X connect 44 0 47 0;
#X connect 56 0 7 0;
