forked from patricksebastien/mtl
-
Notifications
You must be signed in to change notification settings - Fork 0
/
adsr.pd
113 lines (113 loc) · 3.3 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
101
102
103
104
105
106
107
108
109
110
111
112
113
#N canvas 1 82 1351 661 10;
#X obj 1125 44 inlet params;
#X obj 1125 90 print PARAM_NOTFOUND;
#X obj 1125 66 tof/param route;
#X obj 1128 115 b;
#X obj 1129 144 tof/param gui;
#X obj 115 121 inlet;
#X text 111 96 trigger;
#X obj 115 149 sel 0;
#X obj 254 165 t b;
#X msg 115 180 stop;
#X text 112 388 and pack with;
#X text 113 408 attack time;
#X text 41 136 if zero;
#X text 42 153 release;
#X text 22 170 and cancel;
#X text 53 187 decay;
#X text 294 282 on attack \, set a;
#X text 288 315 recall sustain value;
#X text 325 388 pack with decay time;
#X text 615 342 on release ramp;
#X text 616 359 back to zero;
#X obj 472 339 * 0.01;
#X text 57 577 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 23 12 ADSR ENVELOPE;
#X text 212 81 attack;
#X obj 214 102 moses;
#X obj 204 132 t b b;
#X msg 138 300 0;
#X text 30 283 optionally;
#X text 20 301 bash to zero;
#X text 35 256 ATTACK:;
#X text 59 487 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 265 99 test for negative trigger;
#X text 263 123 if so \, zero;
#X text 264 139 the output;
#X text 288 175 in any case;
#X text 313 365 multiply by peak level;
#X text 290 296 delay for sustain;
#X text 286 338 convert from percent;
#X text 165 350 ... then;
#X text 113 369 recall peak level;
#X text 291 159 ... do this;
#X text 57 539 Negative triggers cause the output to jump to zero and
then attack (instead of attacking from the current location).;
#X text 218 11 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 468 439 line;
#X obj 468 464 outlet;
#X obj 176 275 f \$3;
#X obj 448 291 del \$4;
#X obj 176 299 pack 0 \$4;
#X obj 511 365 * \$3;
#X obj 507 388 pack 0 \$5;
#X obj 471 313 f \$5;
#X obj 622 316 pack 0 \$6;
#X obj 677 210 tof/param /sustain-level 50 /g slider 0 100;
#X obj 627 161 tof/param /attack-time 1000 /g nbx;
#X obj 599 132 tof/param /peak-level 1 /g nbx;
#X obj 661 187 tof/param /decay-time 1000 /g nbx;
#X obj 715 236 tof/param /release-time 100 /g nbx;
#X obj 893 47 tof/argument 3;
#X obj 811 6 loadbang;
#X obj 909 71 tof/argument 4;
#X obj 922 95 tof/argument 5;
#X obj 930 119 tof/argument 6;
#X obj 943 144 tof/argument 7;
#X connect 0 0 2 0;
#X connect 2 0 1 0;
#X connect 3 0 4 0;
#X connect 5 0 7 0;
#X connect 7 0 9 0;
#X connect 7 0 52 0;
#X connect 7 1 25 0;
#X connect 8 0 46 0;
#X connect 8 0 47 0;
#X connect 9 0 47 0;
#X connect 21 0 49 0;
#X connect 25 0 26 0;
#X connect 25 1 8 0;
#X connect 26 0 8 0;
#X connect 26 1 27 0;
#X connect 27 0 44 0;
#X connect 44 0 45 0;
#X connect 46 0 48 0;
#X connect 47 0 51 0;
#X connect 48 0 44 0;
#X connect 49 0 50 0;
#X connect 50 0 44 0;
#X connect 51 0 21 0;
#X connect 52 0 44 0;
#X connect 53 0 51 1;
#X connect 54 0 47 1;
#X connect 54 0 48 1;
#X connect 55 0 46 1;
#X connect 55 0 49 1;
#X connect 56 0 50 1;
#X connect 57 0 52 1;
#X connect 58 0 55 0;
#X connect 59 0 58 0;
#X connect 59 0 60 0;
#X connect 59 0 61 0;
#X connect 59 0 62 0;
#X connect 59 0 63 0;
#X connect 60 0 54 0;
#X connect 61 0 56 0;
#X connect 62 0 53 0;
#X connect 63 0 57 0;