aboutsummaryrefslogtreecommitdiff
path: root/pd/doc/3.audio.examples/H07.paf.pd
blob: 56c024c087c6d33ae8d981c5d1e7b986eef49555 (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
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
#N canvas 53 0 782 687 12;
#X floatatom 253 735 0 0 0;
#N canvas 176 241 532 273 output 0;
#X obj 338 160 t b;
#X obj 338 110 f;
#X obj 338 60 inlet;
#X text 344 29 mute;
#X obj 338 185 f;
#X msg 425 178 0;
#X msg 338 85 bang;
#X obj 338 135 moses 1;
#X obj 398 111 moses 1;
#X obj 83 148 dbtorms;
#X obj 398 86 r master-lvl;
#X obj 83 42 r master-lvl;
#X obj 338 210 s master-lvl;
#X obj 17 148 inlet~;
#X obj 199 41 inlet;
#X text 199 18 level;
#X obj 199 100 s master-lvl;
#X msg 96 65 set \$1;
#X obj 96 89 outlet;
#X msg 214 64 \; pd dsp 1;
#X obj 83 194 line~;
#X obj 22 212 *~;
#X obj 22 241 dac~;
#X obj 83 171 pack 0 50;
#X text 15 125 audio;
#X text 93 110 show level;
#X obj 17 177 hip~ 1;
#X connect 0 0 4 0;
#X connect 1 0 7 0;
#X connect 2 0 6 0;
#X connect 4 0 12 0;
#X connect 5 0 12 0;
#X connect 6 0 1 0;
#X connect 7 0 0 0;
#X connect 7 1 5 0;
#X connect 8 1 4 1;
#X connect 9 0 23 0;
#X connect 10 0 1 1;
#X connect 10 0 8 0;
#X connect 11 0 9 0;
#X connect 11 0 17 0;
#X connect 13 0 26 0;
#X connect 14 0 16 0;
#X connect 14 0 19 0;
#X connect 17 0 18 0;
#X connect 20 0 21 1;
#X connect 21 0 22 0;
#X connect 21 0 22 1;
#X connect 23 0 20 0;
#X connect 26 0 21 0;
#X restore 215 764 pd output;
#X msg 291 735 MUTE;
#X obj 158 616 cos~;
#X obj 158 593 *~;
#X obj 201 616 cos~;
#X obj 257 542 wrap~;
#X obj 221 542 -~;
#X obj 201 593 +~;
#X obj 194 646 -~;
#X obj 214 678 *~;
#X obj 176 678 +~;
#X text 515 768 updated for Pd version 0.34;
#X text 336 734 <--output;
#X obj 221 510 samphold~;
#X floatatom 221 369 4 0 0;
#X obj 221 392 / 10;
#X text 221 288 center;
#X obj 221 461 line~;
#X obj 221 415 max 0;
#X text 221 308 freq. (in;
#X text 221 328 tenths of;
#X text 221 348 fundamental);
#X obj 221 438 pack 0 50;
#X obj 104 445 phasor~;
#X floatatom 104 399 4 0 0;
#X text 84 372 fundamental;
#X text 435 441 index;
#X text 435 461 (percent);
#X floatatom 435 482 4 0 0;
#X obj 435 528 line~;
#X obj 343 550 *~;
#X obj 435 505 pack 0 50;
#X graph graph1 0 0 128 500 510 395 766 265;
#X array spectrum 128 float 0;
#X pop;
#X text 501 397 0;
#X text 745 398 5512;
#X msg 80 713 bang;
#N canvas 204 17 358 238 fft 0;
#X obj 46 48 inlet~;
#X obj 159 181 tabwrite~ spectrum;
#X obj 159 145 inlet;
#X obj 46 78 rfft~;
#X obj 46 111 *~;
#X obj 77 111 *~;
#X obj 46 141 sqrt~;
#X obj 191 45 block~ 1024 1;
#X connect 0 0 3 0;
#X connect 2 0 1 0;
#X connect 3 0 4 0;
#X connect 3 0 4 1;
#X connect 3 1 5 0;
#X connect 3 1 5 1;
#X connect 4 0 6 0;
#X connect 5 0 6 0;
#X connect 6 0 1 0;
#X restore 31 745 pd fft;
#X text 82 687 graph;
#X text 31 2 THE PAF: TWO-COSINE RING MODULATOR FOR WAVESHAPER;
#X graph graph4 0 0 199 1 563 718 763 578;
#X array bell-curve 200 float 1;
#A 0 1.12535e-07 1.54727e-07 2.12059e-07 2.89706e-07 3.94519e-07 5.35535e-07
7.24633e-07 9.77371e-07 1.31404e-06 1.76105e-06 2.35258e-06 3.13275e-06
4.15832e-06 5.50199e-06 7.25659e-06 9.54016e-06 1.25023e-05 1.63317e-05
2.1266e-05 2.76026e-05 3.57128e-05 4.60584e-05 5.92113e-05 7.58768e-05
9.69224e-05 0.00012341 0.000156634 0.000198167 0.000249912 0.000314163
0.000393669 0.000491721 0.000612231 0.000759842 0.000940028 0.00115923
0.00142498 0.00174605 0.00213263 0.00259648 0.00315111 0.00381201 0.00459678
0.0055254 0.0066204 0.00790705 0.0094136 0.0111714 0.013215 0.0155826
0.0183156 0.0214592 0.0250621 0.0291763 0.0338573 0.0391639 0.0451575
0.0519019 0.0594631 0.0679081 0.0773047 0.0877205 0.0992216 0.111872
0.125732 0.140858 0.1573 0.1751 0.194291 0.214896 0.236928 0.260383
0.285247 0.311486 0.339053 0.367879 0.397882 0.428956 0.46098 0.493812
0.527292 0.561244 0.595473 0.62977 0.663916 0.697676 0.730811 0.763074
0.794216 0.823987 0.852144 0.878447 0.902668 0.924595 0.944027 0.960789
0.974725 0.985703 0.99362 0.998401 1 0.998401 0.99362 0.985703 0.974725
0.960789 0.944027 0.924595 0.902668 0.878447 0.852144 0.823987 0.794216
0.763074 0.730811 0.697676 0.663916 0.62977 0.595473 0.561244 0.527292
0.493812 0.46098 0.428956 0.397882 0.367879 0.339053 0.311486 0.285247
0.260383 0.236928 0.214896 0.194291 0.1751 0.1573 0.140858 0.125732
0.111872 0.0992216 0.0877205 0.0773047 0.0679081 0.0594631 0.0519019
0.0451575 0.0391639 0.0338573 0.0291763 0.0250621 0.0214592 0.0183156
0.0155826 0.013215 0.0111714 0.0094136 0.00790705 0.0066204 0.0055254
0.00459678 0.00381201 0.00315111 0.00259648 0.00213263 0.00174605 0.00142498
0.00115923 0.000940028 0.000759842 0.000612231 0.000491721 0.000393669
0.000314163 0.000249912 0.000198167 0.000156634 0.00012341 9.69224e-05
7.58768e-05 5.92113e-05 4.60584e-05 3.57128e-05 2.76026e-05 2.1266e-05
1.63317e-05 1.25023e-05 9.54016e-06 7.25659e-06 5.50199e-06 4.15832e-06
3.13275e-06 2.35258e-06 1.76105e-06 1.31404e-06 9.77371e-07 7.24633e-07
5.35535e-07 3.94519e-07 2.89706e-07 2.12059e-07 1.54727e-07;
#X pop;
#N canvas 94 264 600 388 make-table 0;
#X msg 81 44 bang;
#X obj 81 73 t b b;
#X obj 159 142 f;
#X obj 197 142 + 1;
#X msg 175 112 0;
#X obj 81 102 until;
#X obj 161 177 t f f;
#X obj 76 306 tabwrite bell-curve;
#X obj 52 270 expr exp(-$f1*$f1);
#X obj 63 168 sel 199;
#X obj 51 241 expr ($f1-100)/25;
#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 9 0;
#X connect 3 0 2 1;
#X connect 4 0 2 1;
#X connect 5 0 2 0;
#X connect 6 0 10 0;
#X connect 6 1 7 1;
#X connect 8 0 7 0;
#X connect 9 0 5 1;
#X connect 10 0 8 0;
#X restore 627 538 pd make-table;
#X obj 104 422 * 0.5;
#X obj 343 527 cos~;
#X obj 343 504 -~ 0.25;
#X obj 343 573 +~ 100;
#X obj 343 596 tabread4~ bell-curve;
#X obj 104 474 *~ 2;
#X obj 215 707 *~;
#X text 25 33 Instead of using the two cosines as FM carrier oscillators
\, we can use them as ring modulators for a synthetic tone. Here (as
described in the paper) we use a sinusoid looking up a Gaussian bell
curve. This has the nice properties that the partials are always positive
cosines in phase \, and the spectrum spreads out smoothly as the index
changes.;
#X text 26 137 We needed the sine wave to have half the fundamental
frequency \, so we run the phasor~ at half speed but double its output
to the cosine pair and the samphold~ \, thus giving us the original
frequency. As to the half-speed signal \, we take its sine (-~ 0.25
and cos~) \, then center it for lookup in a 200-point table containing
a bell curve.;
#X text 251 705 <--ring mod step;
#X text 375 621 waveshaper;
#X text 27 239 Then with ~* we do the ring modulation and we're done.
;
#X connect 0 0 1 1;
#X connect 1 0 0 0;
#X connect 2 0 1 2;
#X connect 3 0 9 1;
#X connect 3 0 11 0;
#X connect 4 0 8 0;
#X connect 4 0 3 0;
#X connect 5 0 9 0;
#X connect 6 0 7 1;
#X connect 6 0 10 1;
#X connect 7 0 4 1;
#X connect 8 0 5 0;
#X connect 9 0 10 0;
#X connect 10 0 11 1;
#X connect 11 0 48 0;
#X connect 14 0 7 0;
#X connect 14 0 6 0;
#X connect 15 0 16 0;
#X connect 16 0 19 0;
#X connect 18 0 14 0;
#X connect 19 0 23 0;
#X connect 23 0 18 0;
#X connect 24 0 44 0;
#X connect 24 0 47 0;
#X connect 25 0 42 0;
#X connect 29 0 32 0;
#X connect 30 0 31 1;
#X connect 31 0 45 0;
#X connect 32 0 30 0;
#X connect 36 0 37 1;
#X connect 42 0 24 0;
#X connect 43 0 31 0;
#X connect 44 0 43 0;
#X connect 45 0 46 0;
#X connect 46 0 48 1;
#X connect 47 0 14 1;
#X connect 47 0 4 0;
#X connect 47 0 8 0;
#X connect 48 0 1 0;
#X connect 48 0 37 0;