aboutsummaryrefslogtreecommitdiff
path: root/desiredata/doc/3.audio.examples/I06.timbre.stamp.pd
blob: 0fd540cd9fba8492b272f9104d74966cdfd24b9b (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
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
#N canvas 72 0 668 530 12;
#N canvas 147 0 795 617 fft-analysis 0;
#X obj 94 511 *~;
#X obj 55 511 *~;
#X obj 413 356 *~;
#X obj 372 356 *~;
#X obj 372 379 +~;
#X obj 54 183 *~;
#X obj 54 158 inlet~;
#X obj 54 206 rfft~;
#X obj 54 560 *~;
#X obj 141 245 *~;
#X obj 372 333 rfft~;
#X obj 54 535 rifft~;
#X obj 54 583 outlet~;
#X obj 107 245 *~;
#X obj 107 268 +~;
#X text 458 408 modulus;
#X obj 107 420 *~;
#X obj 600 13 block~ 1024 4;
#X obj 107 398 clip~;
#X obj 87 184 tabreceive~ \$0-hann;
#X obj 599 53 loadbang;
#X obj 148 346 r squelch;
#X obj 147 369 expr 0.01*$f1*$f1;
#X obj 107 294 +~ 1e-20;
#X obj 108 480 *~ 0.00065;
#X obj 87 560 tabreceive~ \$0-hann;
#X obj 373 307 *~;
#X obj 373 282 inlet~;
#X obj 406 308 tabreceive~ \$0-hann;
#X obj 107 321 q8_rsqrt~;
#X obj 372 402 q8_sqrt~;
#X text 458 425 of control;
#X text 456 442 amplitude;
#X text 196 248 reciprocal;
#X text 199 267 modulus of;
#X text 195 287 filter input;
#X text 196 306 amplitude;
#X msg 599 76 \; pd dsp 1 \; window-size 1024 \; squelch 30 \; squelch-set
set 30;
#X text 115 159 filter input;
#X text 438 282 control source;
#X text 434 332 Fourier transform;
#X text 28 17 Internal workings of the timbre stamping algorithm. First
the "filter input" is treated as in the compressor patch \, multiplying
each channel amplitude by one over its modulus (but limited by the
"squelch" parameter.) It is then multiplied by the modulus of the channel
amplitude for the control source (which is Fourier analyzed in parallel
with the filter input.);
#X text 145 422 multiply the two amplitude;
#X text 143 439 factors (for compression;
#X text 145 455 and to apply new timbre);
#X connect 0 0 11 1;
#X connect 1 0 11 0;
#X connect 2 0 4 1;
#X connect 3 0 4 0;
#X connect 4 0 30 0;
#X connect 5 0 7 0;
#X connect 6 0 5 0;
#X connect 7 0 13 0;
#X connect 7 0 13 1;
#X connect 7 0 1 0;
#X connect 7 1 9 0;
#X connect 7 1 9 1;
#X connect 7 1 0 0;
#X connect 8 0 12 0;
#X connect 9 0 14 1;
#X connect 10 0 3 0;
#X connect 10 0 3 1;
#X connect 10 1 2 0;
#X connect 10 1 2 1;
#X connect 11 0 8 0;
#X connect 13 0 14 0;
#X connect 14 0 23 0;
#X connect 16 0 24 0;
#X connect 18 0 16 0;
#X connect 19 0 5 1;
#X connect 20 0 37 0;
#X connect 21 0 22 0;
#X connect 22 0 18 2;
#X connect 23 0 29 0;
#X connect 24 0 0 1;
#X connect 24 0 1 1;
#X connect 25 0 8 1;
#X connect 26 0 10 0;
#X connect 27 0 26 0;
#X connect 28 0 26 1;
#X connect 29 0 18 0;
#X connect 30 0 16 1;
#X restore 86 444 pd fft-analysis;
#X text 137 12 CORT&ZACK's SECRET;
#X text 27 422 filter;
#X text 29 437 input;
#X text 232 441 source;
#X text 233 422 control;
#X floatatom 53 300 0 0 500 0 - squelch-set -;
#X obj 53 324 s squelch;
#X obj 86 468 output~;
#X msg 157 278 ../sound/bell.aiff;
#X msg 157 303 ../sound/voice.wav;
#X msg 157 328 ../sound/voice2.wav;
#X obj 157 354 s read-sound1;
#X msg 373 280 ../sound/bell.aiff;
#X msg 373 305 ../sound/voice.wav;
#X msg 373 330 ../sound/voice2.wav;
#X obj 373 355 s read-sound2;
#X text 386 256 control source;
#X text 169 255 filter input;
#X text 255 231 change input sounds;
#X floatatom 454 409 5 0 0 0 - #0-samp-msec -;
#X obj 87 394 bng 15 250 50 0 empty empty empty 0 -6 0 8 -262144 -1
-1;
#X obj 215 395 bng 15 250 50 0 empty empty empty 0 -6 0 8 -262144 -1
-1;
#N canvas 190 43 661 593 test-signals 0;
#X obj 90 444 line~;
#X obj 90 369 f;
#X obj 90 524 outlet~;
#X msg 90 423 0 \, \$1 \$2;
#X obj 90 397 pack 0 0;
#X obj 190 344 /;
#X obj 249 325 * 0.001;
#X obj 90 497 hip~ 5;
#X obj 35 246 loadbang;
#X msg 90 322 1;
#X obj 90 344 metro 1000;
#X obj 191 302 t b b f;
#X obj 117 270 t b f;
#X obj 90 469 tabread4~ \$0-sample;
#X text 21 28 test signal: looped sample playback;
#X obj 40 159 hip~ 5;
#X obj 40 135 adc~ 1;
#X obj 102 159 s insamprate;
#X obj 40 98 inlet;
#X obj 102 135 samplerate~;
#X obj 116 246 r \$0-samplength;
#X obj 191 276 r \$0-insamprate;
#X obj 40 182 tabwrite~ \$0-sample;
#X obj 398 437 line~;
#X obj 398 362 f;
#X obj 398 517 outlet~;
#X msg 398 416 0 \, \$1 \$2;
#X obj 398 390 pack 0 0;
#X obj 498 337 /;
#X obj 557 318 * 0.001;
#X obj 398 490 hip~ 5;
#X obj 343 239 loadbang;
#X msg 398 315 1;
#X obj 398 337 metro 1000;
#X obj 499 295 t b b f;
#X obj 425 263 t b f;
#X obj 348 152 hip~ 5;
#X obj 348 128 adc~ 1;
#X obj 348 91 inlet;
#X obj 410 128 samplerate~;
#X obj 410 152 s insamprate2;
#X obj 348 175 tabwrite~ \$0-sample2;
#X obj 424 239 r \$0-samplength2;
#X obj 499 269 r \$0-insamprate2;
#X obj 398 462 tabread4~ \$0-sample2;
#X connect 0 0 13 0;
#X connect 1 0 4 0;
#X connect 3 0 0 0;
#X connect 4 0 3 0;
#X connect 5 0 4 1;
#X connect 5 0 10 1;
#X connect 6 0 5 1;
#X connect 7 0 2 0;
#X connect 8 0 9 0;
#X connect 9 0 10 0;
#X connect 10 0 1 0;
#X connect 11 0 9 0;
#X connect 11 1 5 0;
#X connect 11 2 6 0;
#X connect 12 0 9 0;
#X connect 12 1 5 0;
#X connect 12 1 1 1;
#X connect 13 0 7 0;
#X connect 15 0 22 0;
#X connect 16 0 15 0;
#X connect 18 0 19 0;
#X connect 18 0 16 0;
#X connect 19 0 17 0;
#X connect 20 0 12 0;
#X connect 21 0 11 0;
#X connect 23 0 44 0;
#X connect 24 0 27 0;
#X connect 26 0 23 0;
#X connect 27 0 26 0;
#X connect 28 0 27 1;
#X connect 28 0 33 1;
#X connect 29 0 28 1;
#X connect 30 0 25 0;
#X connect 31 0 32 0;
#X connect 32 0 33 0;
#X connect 33 0 24 0;
#X connect 34 0 32 0;
#X connect 34 1 28 0;
#X connect 34 2 29 0;
#X connect 35 0 32 0;
#X connect 35 1 28 0;
#X connect 35 1 24 1;
#X connect 36 0 41 0;
#X connect 37 0 36 0;
#X connect 38 0 39 0;
#X connect 38 0 37 0;
#X connect 39 0 40 0;
#X connect 42 0 35 0;
#X connect 43 0 34 0;
#X connect 44 0 30 0;
#X restore 87 415 pd test-signals;
#X text 104 393 <- record ->;
#N canvas 388 86 722 350 insample2 0;
#N canvas 0 0 450 300 graph1 0;
#X array \$0-sample2 62079 float 0;
#X coords 0 1 62078 -1 400 150 1;
#X restore 298 24 graph;
#X obj 19 74 unpack s f;
#X obj 19 184 soundfiler;
#X text 356 250 read a sample;
#X obj 276 249 loadbang;
#X obj 19 100 t s b;
#X obj 19 135 pack s s;
#X msg 19 160 read -resize \$1 \$2;
#X obj 74 46 44100;
#X obj 19 47 t a b;
#X obj 19 247 /;
#X obj 19 271 * 1000;
#X obj 19 23 r read-sound2;
#X obj 116 74 s \$0-insamprate2;
#X obj 75 99 symbol \$0-sample2;
#X obj 29 208 s \$0-samplength2;
#X obj 57 247 r \$0-insamprate2;
#X obj 19 294 s \$0-samp2-msec;
#X msg 276 273 \; read-sound2 ../sound/voice.wav;
#X connect 1 0 5 0;
#X connect 1 1 13 0;
#X connect 2 0 10 0;
#X connect 2 0 15 0;
#X connect 4 0 18 0;
#X connect 5 0 6 0;
#X connect 5 1 14 0;
#X connect 6 0 7 0;
#X connect 7 0 2 0;
#X connect 8 0 13 0;
#X connect 9 0 1 0;
#X connect 9 1 8 0;
#X connect 10 0 11 0;
#X connect 11 0 17 0;
#X connect 12 0 9 0;
#X connect 14 0 6 1;
#X connect 16 0 10 1;
#X restore 334 430 pd insample2;
#N canvas 388 86 722 350 insample1 0;
#N canvas 0 0 450 300 graph1 0;
#X array \$0-sample 155948 float 0;
#X coords 0 1 155947 -1 400 150 1;
#X restore 259 24 graph;
#X obj 19 74 unpack s f;
#X obj 19 184 soundfiler;
#X text 356 250 read a sample;
#X obj 276 249 loadbang;
#X obj 19 100 t s b;
#X obj 75 99 symbol \$0-sample;
#X obj 19 135 pack s s;
#X msg 19 160 read -resize \$1 \$2;
#X obj 74 46 44100;
#X obj 19 47 t a b;
#X obj 29 208 s \$0-samplength;
#X obj 116 74 s \$0-insamprate;
#X obj 19 247 /;
#X obj 19 271 * 1000;
#X obj 19 294 s \$0-samp-msec;
#X obj 57 247 r \$0-insamprate;
#X obj 19 23 r read-sound1;
#X msg 276 273 \; read-sound1 ../sound/bell.aiff;
#X connect 1 0 5 0;
#X connect 1 1 12 0;
#X connect 2 0 11 0;
#X connect 2 0 13 0;
#X connect 4 0 18 0;
#X connect 5 0 7 0;
#X connect 5 1 6 0;
#X connect 6 0 7 1;
#X connect 7 0 8 0;
#X connect 8 0 2 0;
#X connect 9 0 12 0;
#X connect 10 0 1 0;
#X connect 10 1 9 0;
#X connect 13 0 14 0;
#X connect 14 0 15 0;
#X connect 16 0 13 1;
#X connect 17 0 10 0;
#X restore 334 408 pd insample1;
#X floatatom 453 432 5 0 0 0 - #0-samp2-msec -;
#N canvas 0 110 565 454 hann-window 0;
#N canvas 0 0 450 300 graph1 0;
#X array \$0-hann 1024 float 0;
#X coords 0 1 1023 0 300 100 1;
#X restore 82 311 graph;
#X obj 378 165 osc~;
#X obj 378 190 *~ -0.5;
#X obj 378 214 +~ 0.5;
#X obj 331 247 tabwrite~ \$0-hann;
#X obj 37 88 r window-size;
#X obj 38 173 /;
#X obj 127 142 samplerate~;
#X obj 38 251 s window-sec;
#X obj 177 204 swap;
#X obj 177 228 /;
#X obj 177 252 s window-hz;
#X obj 49 201 * 1000;
#X obj 49 228 s window-msec;
#X obj 38 115 t f b f;
#X msg 173 92 resize \$1;
#X obj 173 116 s \$0-hann;
#X obj 330 105 r window-hz;
#X msg 382 130 0;
#X obj 330 131 t f b;
#X text 15 8 calculate Hann window table (variable window size) and
constants window-hz (fundamental frequency of analysis) \, window-sec
and window-msec (analysis window size in seconds and msec).;
#X connect 1 0 2 0;
#X connect 2 0 3 0;
#X connect 3 0 4 0;
#X connect 5 0 14 0;
#X connect 6 0 8 0;
#X connect 6 0 12 0;
#X connect 7 0 6 1;
#X connect 7 0 9 1;
#X connect 9 0 10 0;
#X connect 9 1 10 1;
#X connect 10 0 11 0;
#X connect 12 0 13 0;
#X connect 14 0 6 0;
#X connect 14 0 9 0;
#X connect 14 1 7 0;
#X connect 14 2 15 0;
#X connect 15 0 16 0;
#X connect 17 0 19 0;
#X connect 18 0 1 1;
#X connect 19 0 1 0;
#X connect 19 1 4 0;
#X connect 19 1 18 0;
#X restore 334 455 pd hann-window;
#X text 509 412 sample lengths \,;
#X text 510 427 msec;
#X text 27 35 This is a Fourier-based "vocoder" (perhaps better called
a "timbre stamp") like the one the Convolution brothers use. The "control
source" is analyzed to get its spectral envelope \, which is then stamped
onto the "filter input" by adjusting the amplitudes of its Fourier
transform. The "filter input" is first whitened by the compression
algorithm from the previous patch in this series. The best value of
"squelch" to use depends critically on what kind of sounds are used
for the filter input and the control source.;
#X text 402 498 updated for Pd version 0.39;
#X connect 0 0 8 0;
#X connect 0 0 8 1;
#X connect 6 0 7 0;
#X connect 9 0 12 0;
#X connect 10 0 12 0;
#X connect 11 0 12 0;
#X connect 13 0 16 0;
#X connect 14 0 16 0;
#X connect 15 0 16 0;
#X connect 21 0 23 0;
#X connect 22 0 23 1;
#X connect 23 0 0 0;
#X connect 23 1 0 1;