aboutsummaryrefslogtreecommitdiff
path: root/desiredata/doc/3.audio.examples/D05.envelope.pitch.pd
blob: b91477aab77eee6fef58504e6d234545ad479097 (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
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
#N canvas 222 84 686 544 12;
#X obj 48 106 r trigger;
#X obj 48 154 tabread4~ dbtorms;
#X text 144 313 <-- attack;
#X text 568 305 <-- release;
#X obj 48 208 *~;
#N canvas 151 343 812 522 make-table 0;
#X msg 82 49 bang;
#X obj 82 78 t b b;
#X obj 141 142 f;
#X obj 179 142 + 1;
#X msg 150 112 0;
#X obj 82 107 until;
#X obj 141 176 t f f;
#X floatatom 369 67 0 0 0 0 - - -;
#X floatatom 369 127 0 0 0 0 - - -;
#N canvas 0 0 450 300 graph1 0;
#X array dbtorms 123 float 1;
#A 0 0 0 1.25893e-05 1.41254e-05 1.58489e-05 1.77828e-05 1.99526e-05
2.23872e-05 2.51189e-05 2.81838e-05 3.16228e-05 3.54813e-05 3.98107e-05
4.46684e-05 5.01187e-05 5.62341e-05 6.30957e-05 7.07946e-05 7.94328e-05
8.91251e-05 1e-04 0.000112202 0.000125893 0.000141254 0.000158489 0.000177828
0.000199526 0.000223872 0.000251189 0.000281838 0.000316228 0.000354813
0.000398107 0.000446684 0.000501187 0.000562341 0.000630957 0.000707946
0.000794328 0.000891251 0.001 0.00112202 0.00125893 0.00141254 0.00158489
0.00177828 0.00199526 0.00223872 0.00251189 0.00281838 0.00316228 0.00354813
0.00398107 0.00446684 0.00501187 0.00562341 0.00630957 0.00707946 0.00794328
0.00891251 0.01 0.0112202 0.0125893 0.0141254 0.0158489 0.0177828 0.0199526
0.0223872 0.0251189 0.0281838 0.0316228 0.0354813 0.0398107 0.0446684
0.0501187 0.0562341 0.0630957 0.0707946 0.0794328 0.0891251 0.1 0.112202
0.125893 0.141254 0.158489 0.177828 0.199526 0.223872 0.251189 0.281838
0.316228 0.354813 0.398107 0.446684 0.501187 0.562341 0.630957 0.707946
0.794328 0.891251 1 1.12202 1.25893 1.41254 1.58489 1.77828 1.99526
2.23872 2.51189 2.81838 3.16228 3.54813 3.98107 4.46684 5.01187 5.62341
6.30957 7.07946 7.94328 8.91251 10 11.2202 12.5893;
#X coords 0 10 123 0 200 100 1;
#X restore 538 298 graph;
#X text 740 391 0;
#X text 742 291 10;
#X text 544 403 ------ 123 samples ------;
#N canvas 0 0 450 300 graph2 0;
#X array mtof 130 float 1;
#A 0 8.1758 8.66196 9.17702 9.72272 10.3009 10.9134 11.5623 12.2499
12.9783 13.75 14.5676 15.4339 16.3516 17.3239 18.354 19.4454 20.6017
21.8268 23.1247 24.4997 25.9565 27.5 29.1352 30.8677 32.7032 34.6478
36.7081 38.8909 41.2034 43.6535 46.2493 48.9994 51.9131 55 58.2705
61.7354 65.4064 69.2957 73.4162 77.7817 82.4069 87.3071 92.4986 97.9989
103.826 110 116.541 123.471 130.813 138.591 146.832 155.563 164.814
174.614 184.997 195.998 207.652 220 233.082 246.942 261.626 277.183
293.665 311.127 329.628 349.228 369.994 391.995 415.305 440 466.164
493.883 523.251 554.365 587.33 622.254 659.255 698.456 739.989 783.991
830.609 880 932.328 987.767 1046.5 1108.73 1174.66 1244.51 1318.51
1396.91 1479.98 1567.98 1661.22 1760 1864.66 1975.53 2093 2217.46 2349.32
2489.02 2637.02 2793.83 2959.96 3135.96 3322.44 3520 3729.31 3951.07
4186.01 4434.92 4698.64 4978.03 5274.04 5587.65 5919.91 6271.93 6644.88
7040 7458.62 7902.13 8372.02 8869.84 9397.27 9956.06 10548.1 11175.3
11839.8 12543.9 13289.8 14080;
#X coords 0 12000 130 0 200 100 1;
#X restore 537 130 graph;
#X obj 283 102 mtof;
#X floatatom 282 127 0 0 0 0 - - -;
#X text 541 237 ------ 130 samples ------;
#X text 746 223 0;
#X text 748 123 12000;
#X obj 81 203 mtof;
#X obj 72 167 sel 129;
#X obj 80 229 tabwrite mtof;
#X obj 369 99 tabread4 mtof;
#X obj 71 418 moses 2;
#X msg 55 267 bang;
#X obj 55 296 t b b;
#X obj 126 357 f;
#X obj 164 357 + 1;
#X msg 148 329 0;
#X obj 55 325 until;
#X obj 47 385 sel 122;
#X msg 71 449 0;
#X obj 115 450 dbtorms;
#X obj 126 385 t f f;
#X obj 71 482 tabwrite dbtorms;
#X text 312 40 ... and test accuracy;
#X text 23 15 patch to recalculate the mtof table;
#X text 107 267 bang to recalculate dbtorms table;
#X connect 0 0 1 0;
#X connect 1 0 5 0;
#X connect 1 1 4 0;
#X connect 2 0 3 0;
#X connect 2 0 6 0;
#X connect 2 0 20 0;
#X connect 3 0 2 1;
#X connect 4 0 2 1;
#X connect 5 0 2 0;
#X connect 6 0 19 0;
#X connect 6 1 21 1;
#X connect 7 0 14 0;
#X connect 7 0 22 0;
#X connect 14 0 15 0;
#X connect 19 0 21 0;
#X connect 20 0 5 1;
#X connect 22 0 8 0;
#X connect 23 0 31 0;
#X connect 23 1 32 0;
#X connect 24 0 25 0;
#X connect 25 0 29 0;
#X connect 25 1 28 0;
#X connect 26 0 27 0;
#X connect 26 0 30 0;
#X connect 26 0 33 0;
#X connect 27 0 26 1;
#X connect 28 0 26 1;
#X connect 29 0 26 0;
#X connect 30 0 29 1;
#X connect 31 0 34 0;
#X connect 32 0 34 0;
#X connect 33 0 23 0;
#X connect 33 1 34 1;
#X restore 451 222 pd make-table;
#X text 35 6 PITCH ENVELOPES;
#X text 125 24 For pitch envelopes \, unlike amplitude envelopes \,
discontinuities are allowed and sometimes you would rather the envelope
generator actually jump to zero when it's triggered. The "adsr" object
does this for you if you send a negative trigger instead of a positive
one:;
#X obj 280 106 r trigger2;
#X obj 280 178 tabread4~ mtof;
#X obj 280 202 osc~;
#X msg 46 299 \; pd dsp 1 \; trigger 1 \; trigger2 1;
#X text 358 297 <-- attack;
#X msg 249 293 \; pd dsp 1 \; trigger 1 \; trigger2 -1;
#X msg 472 293 \; pd dsp 1 \; trigger 0 \; trigger2 0;
#X obj 280 154 +~ 69;
#X text 358 314 restarting;
#X text 363 331 pitch env;
#X text 37 377 We have added a new table \, mtof \, for converting
audio signals from pitch to frequency. Its range is 1-127 \, so you
want to add a base pitch in before you start reading from it.;
#X text 37 443 This is an extreme use of pitch enveloping. In a real
situation you might want an envelope controlling vibrato depth or the
like instead of straight pitch.;
#X obj 48 130 adsr 100 50 200 90 1000;
#X obj 280 130 adsr 20 200 100 100 1000;
#X text 413 497 updated for Pd version 0.37;
#X obj 48 233 output~;
#X connect 0 0 20 0;
#X connect 1 0 4 0;
#X connect 4 0 23 0;
#X connect 4 0 23 1;
#X connect 8 0 21 0;
#X connect 9 0 10 0;
#X connect 10 0 4 1;
#X connect 15 0 9 0;
#X connect 20 0 1 0;
#X connect 21 0 15 0;