aboutsummaryrefslogtreecommitdiff
path: root/pd/doc/3.audio.examples/J04.more.adsr.pd
blob: 5b38917a85ef23244ff2733ae9e6126905eba2c3 (plain)
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
114
115
116
117
#N canvas 105 38 705 609 12;
#X obj 39 140 r trigger;
#X floatatom 70 376 0 0 0;
#N canvas 159 26 495 266 output 0;
#X obj 351 166 t b;
#X obj 351 114 f;
#X obj 351 62 inlet;
#X text 358 30 mute;
#X obj 351 192 f;
#X msg 442 185 0;
#X msg 351 88 bang;
#X obj 351 140 moses 1;
#X obj 442 159 t b f;
#X obj 413 122 moses 1;
#X obj 86 154 dbtorms;
#X obj 413 96 r master-lvl;
#X obj 86 44 r master-lvl;
#X obj 351 218 s master-lvl;
#X obj 23 188 inlet~;
#X obj 207 42 inlet;
#X text 207 19 level;
#X obj 207 104 s master-lvl;
#X msg 100 67 set \$1;
#X obj 100 93 outlet;
#X msg 222 66 \; pd dsp 1;
#X obj 86 202 line~;
#X obj 23 221 *~;
#X obj 23 250 dac~;
#X obj 86 178 pack 0 50;
#X text 21 165 audio;
#X text 97 114 show level;
#X connect 0 0 4 0;
#X connect 1 0 7 0;
#X connect 2 0 6 0;
#X connect 4 0 13 0;
#X connect 5 0 13 0;
#X connect 6 0 1 0;
#X connect 7 0 0 0;
#X connect 7 1 8 0;
#X connect 8 0 5 0;
#X connect 9 1 4 1;
#X connect 10 0 24 0;
#X connect 11 0 1 1;
#X connect 11 0 9 0;
#X connect 12 0 10 0;
#X connect 12 0 18 0;
#X connect 14 0 22 0;
#X connect 15 0 17 0;
#X connect 15 0 20 0;
#X connect 18 0 19 0;
#X connect 21 0 22 1;
#X connect 22 0 23 0;
#X connect 22 0 23 1;
#X connect 24 0 21 0;
#X restore 39 406 pd output;
#X msg 107 376 MUTE;
#X text 150 375 <-- output amplitude;
#X text 518 189 <-- attack;
#X text 485 281 <-- release;
#X obj 39 338 *~;
#X obj 39 282 *~;
#X obj 39 310 *~;
#X obj 80 340 osc~ 440;
#X text 88 9 ADSR envelope;
#X text 35 29 You can use the quartic trick to simplify patches using
ADSR envelopes. For amplitude control it's especially simple. It's
usually good enough in practice to control amplitudes by ranging an
ADSR from 0 to 1 (divide by 100 so your input range can be a comfortable
0-100) \, then take fourth power:;
#X obj 77 227 / 100;
#X floatatom 77 197 3 0 100;
#X msg 383 269 \; trigger 0;
#X obj 39 166 unpack;
#X floatatom 39 197 1 0 100;
#X msg 383 175 \; trigger 1 100;
#X text 503 229 <-- softer attack;
#X msg 382 222 \; trigger 1 60;
#X text 441 583 updated for Pd version 0.34;
#X text 14 437 Note that the units aren't dB \; for most of the range
0-100 it's about 0.4 dB per unit. If you want something closer to dB
\, you can set the scale as 0-40 instead of 0-100 (just change "/ 100"
to "/ 40") and then you'll get the response shown in the first patch
in this section.;
#X obj 596 519 *~;
#X obj 596 547 *~;
#X floatatom 605 390 3 0 100;
#X obj 605 416 mtof;
#X obj 605 441 sqrt;
#X obj 605 466 sqrt;
#X text 174 526 To use ADSR to control pitch \, you should;
#X text 173 545 usually just use real pitch units like this-->;
#X obj 596 490 adsr 0;
#X obj 39 253 adsr 0 100 200 70 300;
#X connect 0 0 16 0;
#X connect 1 0 2 1;
#X connect 2 0 1 0;
#X connect 3 0 2 2;
#X connect 7 0 2 0;
#X connect 8 0 9 0;
#X connect 8 0 9 1;
#X connect 9 0 7 0;
#X connect 10 0 7 1;
#X connect 13 0 32 1;
#X connect 14 0 13 0;
#X connect 16 0 17 0;
#X connect 16 1 14 0;
#X connect 17 0 32 0;
#X connect 23 0 24 0;
#X connect 23 0 24 1;
#X connect 25 0 26 0;
#X connect 26 0 27 0;
#X connect 27 0 28 0;
#X connect 28 0 31 1;
#X connect 31 0 23 0;
#X connect 31 0 23 1;
#X connect 32 0 8 0;
#X connect 32 0 8 1;