-
Notifications
You must be signed in to change notification settings - Fork 0
/
adsr.pd
100 lines (100 loc) · 2.93 KB
/
adsr.pd
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
#N canvas 1132 101 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 263 164 t b;
#X obj 190 273 f \$1;
#X obj 190 298 pack 0 \$2;
#X obj 495 160 inlet;
#X obj 422 285 del \$2;
#X obj 595 456 line~;
#X obj 446 313 f \$4;
#X obj 485 388 pack 0 \$3;
#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 text 438 138 level;
#X obj 485 364 * \$1;
#X obj 595 486 outlet~;
#X text 57 135 if zero;
#X text 57 152 release;
#X text 36 169 and cancel;
#X text 71 186 decay;
#X text 667 307 on release ramp;
#X text 668 324 back to zero;
#X obj 446 338 * 0.01;
#X text 82 564 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.;
#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 82 474 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.;
#X text 596 564 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 442 122 peak;
#X text 303 158 ... do this;
#X text 82 526 Negative triggers cause the output to jump to zero and
then attack (instead of attacking from the current location).;
#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 obj 596 356 s line;
#X obj 485 419 s line;
#X obj 190 328 s line;
#X obj 595 419 r line;
#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 57 288 optionally bash to zero, f 12;
#X text 21 326 then recall peak level and pack with attack time and
send to line~, f 22;
#X text 387 420 send to line~;
#X text 645 356 send to line~;
#X text 649 412 get attack/decay/release lines, f 23;
#X text 644 456 generate envelope;
#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 34 0;
#X connect 4 0 5 0;
#X connect 4 0 8 0;
#X connect 5 0 6 0;
#X connect 6 0 50 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 26 0;
#X connect 11 0 49 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 48 0;
#X connect 18 0 11 0;
#X connect 26 0 18 0;
#X connect 34 0 35 0;
#X connect 34 1 4 0;
#X connect 35 0 4 0;
#X connect 35 1 36 0;
#X connect 36 0 50 0;
#X connect 51 0 9 0;