aboutsummaryrefslogtreecommitdiff
path: root/pd/doc/4.fft.examples/12.sinedecomposer.pd
blob: 3623af2808ae2e5df2b2ecf4bc738fbf6801e72d (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
#N struct peak-template float x float y float amp float ampreal float
ampimag;
#N canvas 82 391 858 492 12;
#X msg 501 258 bang;
#X obj 30 360 pack 0 100;
#X obj 30 384 line~;
#X obj 30 336 dbtorms;
#N canvas 95 102 724 400 fft 0;
#X obj 64 67 inlet~;
#X obj 134 107 print~;
#X msg 137 71 bang;
#X obj 64 104 rfft~;
#N canvas 0 0 450 300 graph3 0;
#X array array3 4096 float 0;
#X coords 0 100 4096 -100 400 150 1;
#X restore 254 14 graph;
#N canvas 0 0 450 300 graph4 0;
#X array array4 4096 float 0;
#X coords 0 100 4096 -100 400 150 1;
#X restore 256 165 graph;
#X obj 9 185 tabsend~ array3;
#X obj 50 158 tabsend~ array4;
#X msg 37 246 \; array3 resize 4096 \; array4 resize 4096;
#X obj 62 38 block~ 4096 1;
#X connect 0 0 1 0;
#X connect 0 0 3 0;
#X connect 2 0 1 0;
#X connect 3 0 6 0;
#X connect 3 1 7 0;
#X restore 134 409 pd fft;
#X obj 30 408 *~;
#X obj 29 435 dac~;
#X obj 476 231 adc~;
#N canvas 204 36 521 368 analysis 1;
#X obj 206 37 inlet;
#X msg 207 68 bang;
#X obj 275 52 r snapshot;
#X msg 220 169 4096 array3 array4 50;
#X obj 127 252 print;
#X obj 206 103 t b b b;
#X obj 122 140 s done-analysis;
#X obj 248 133 s start-analysis;
#X obj 220 219 s found-peak;
#X obj 154 194 r loud;
#X obj 128 226 spigot;
#X obj 220 193 pique;
#X connect 0 0 1 0;
#X connect 1 0 5 0;
#X connect 2 0 1 0;
#X connect 3 0 11 0;
#X connect 5 0 6 0;
#X connect 5 1 3 0;
#X connect 5 2 7 0;
#X connect 9 0 10 1;
#X connect 10 0 4 0;
#X connect 11 0 8 0;
#X connect 11 0 10 0;
#X restore 613 295 pd analysis;
#X obj 30 313 r loop-amp;
#X msg 613 271 snapshot;
#X text 23 167 click here first;
#X text 613 247 analysis;
#N canvas 36 255 884 389 peak-saver 0;
#X floatatom 710 310 0 0 0 0 - - -;
#X floatatom 633 309 0 0 0 0 - - -;
#X floatatom 560 305 0 0 0 0 - - -;
#X floatatom 484 303 0 0 0 0 - - -;
#X obj 406 251 pointer;
#X obj 354 150 pointer;
#X msg 374 60 bang;
#X obj 142 243 rmstodb;
#X obj 10 244 * 0.1;
#X obj 141 268 * -3;
#X floatatom 416 300 0 0 0 0 - - -;
#X obj 353 36 r start-analysis;
#X obj 354 89 t b b;
#X msg 29 89 50 60 70;
#X obj 28 120 append peak-template x y amp;
#X msg 426 225 next;
#X obj 402 276 get peak-template x y amp ampreal ampimag;
#X obj 9 293 append peak-template x y amp ampreal ampimag;
#X obj 116 167 r found-peak;
#X obj 117 196 unpack 0 0 0 0 0;
#X msg 76 244 330;
#X msg 400 87 \; pd-peak-list clear;
#X msg 354 125 traverse pd-peak-list \, bang;
#X msg 408 201 traverse pd-peak-list \, next;
#X connect 4 0 16 0;
#X connect 5 0 14 3;
#X connect 5 0 17 5;
#X connect 6 0 12 0;
#X connect 7 0 9 0;
#X connect 8 0 17 0;
#X connect 9 0 17 2;
#X connect 11 0 12 0;
#X connect 12 0 22 0;
#X connect 12 1 21 0;
#X connect 13 0 14 0;
#X connect 15 0 4 0;
#X connect 16 0 10 0;
#X connect 16 1 3 0;
#X connect 16 2 2 0;
#X connect 16 3 1 0;
#X connect 16 4 0 0;
#X connect 18 0 19 0;
#X connect 19 1 8 0;
#X connect 19 2 20 0;
#X connect 19 2 7 0;
#X connect 19 3 17 3;
#X connect 19 4 17 4;
#X connect 20 0 17 1;
#X connect 22 0 5 0;
#X connect 23 0 4 0;
#X restore 339 378 pd peak-saver;
#N canvas 231 169 656 237 peak-template 0;
#X obj 45 90 filledpolygon 3 3 3 0 0 0 amp 0 0;
#X obj 37 16 struct peak-template float x float y float amp float ampreal
float ampimag;
#X restore 339 402 pd peak-template;
#N canvas 0 0 600 382 peak-list 1;
#X scalar peak-template 58.2195 330 -122.487 0.000825282 -0.000727483
\;;
#X scalar peak-template 113.041 330 -92.8753 -0.000338659 0.00010002
\;;
#X scalar peak-template 118.46 330 -94.8943 0.00031586 -0.000214072
\;;
#X scalar peak-template 138.93 330 -0 3.25541e-06 -5.9315e-06 \;;
#X scalar peak-template 142.074 330 -0 7.21258e-06 6.84986e-07 \;;
#X scalar peak-template 146.444 330 -0 -7.88035e-06 8.62137e-07 \;
;
#X scalar peak-template 172.29 330 -79.5955 0.000108583 0.000182228
\;;
#X scalar peak-template 177.651 330 -85.3731 -0.000234655 0.00012266
\;;
#X scalar peak-template 195.809 330 -0 2.79175e-06 -8.34867e-06 \;
;
#X scalar peak-template 203.103 330 -0 5.14234e-06 -6.78858e-06 \;
;
#X scalar peak-template 211.356 330 -0 -5.54349e-06 -6.98329e-06 \;
;
#X scalar peak-template 221.688 330 -42.6342 -5.09215e-05 6.6466e-06
\;;
#X scalar peak-template 226.081 330 -43.02 5.18789e-05 5.00157e-06
\;;
#X scalar peak-template 229.339 330 -43.3736 -1.05481e-05 -5.17679e-05
\;;
#X scalar peak-template 274.262 330 -12.1351 -2.70512e-06 1.57e-05
\;;
#X scalar peak-template 277.663 330 -12.8808 -1.61933e-05 2.5564e-06
\;;
#X scalar peak-template 290.641 330 -0 2.56841e-06 6.25735e-06 \;;
#X scalar peak-template 303.545 330 -0 -5.80611e-06 4.01017e-06 \;
;
#X scalar peak-template 306.665 330 -0 6.64873e-06 2.12955e-06 \;;
#X scalar peak-template 332.606 330 -31.28 -2.93873e-05 1.54798e-05
\;;
#X scalar peak-template 342.348 330 -39.2289 4.48755e-05 4.09977e-06
\;;
#X scalar peak-template 349.861 330 -42.7285 -4.16831e-05 -3.03127e-05
\;;
#X scalar peak-template 358.384 330 -16.8763 8.55105e-06 -1.70906e-05
\;;
#X scalar peak-template 364.267 330 -0 -8.11825e-06 3.74108e-06 \;
;
#X scalar peak-template 381.317 330 -0 1.65706e-07 -7.33649e-06 \;
;
#X scalar peak-template 390.885 330 -0.231076 9.93783e-06 1.7404e-06
\;;
#X scalar peak-template 401.603 330 -2.38845 -3.17752e-06 -1.04892e-05
\;;
#X scalar peak-template 408.086 330 -0.241569 2.517e-06 -9.77426e-06
\;;
#X restore 339 426 pd peak-list;
#X msg 38 192 \; pd dsp 1;
#X obj 720 296 s loud;
#X floatatom 557 77 0 0 0 0 - - -;
#N canvas 194 37 730 728 output 0;
#X obj 77 218 t b;
#X obj 77 154 f;
#X obj 66 71 inlet;
#X text 73 46 mute;
#X obj 77 244 f;
#X msg 156 235 0;
#X msg 69 102 bang;
#X obj 77 189 moses 1;
#X obj 169 33 r loop-amp;
#X obj 78 286 s loop-amp;
#X obj 156 179 t b f;
#X obj 93 462 outlet;
#X msg 92 428 set \$1;
#X obj 93 400 r loop-amp;
#X connect 0 0 4 0;
#X connect 1 0 7 0;
#X connect 2 0 6 0;
#X connect 4 0 9 0;
#X connect 5 0 9 0;
#X connect 6 0 1 0;
#X connect 7 0 0 0;
#X connect 7 1 10 0;
#X connect 8 0 1 1;
#X connect 10 0 5 0;
#X connect 10 1 4 1;
#X connect 12 0 11 0;
#X connect 13 0 12 0;
#X restore 557 53 pd output;
#X obj 557 104 s loop-amp;
#X msg 557 30 mute;
#X text 593 80 AMPLITUDE;
#X text 539 189 live sample;
#X text 719 234 print out;
#X text 720 249 peak list;
#X text 168 7 SPECTRAL SNAPSHOTS.;
#X text 15 18 This patch reads a soundfile or records a live sound.
When you click on "snapshot" the peak-list window shows a list of the
sinusoidal peaks that were found at that instant in the sound. You
can also ask for the peak lists to be printed out.;
#N canvas 132 255 634 331 insample 0;
#N canvas 0 0 450 300 graph1 0;
#X array sample 39075 float 0;
#X coords 0 1 39074 -1 400 150 1;
#X restore 199 18 graph;
#X obj 19 70 r read-sample;
#X obj 19 95 unpack s f;
#X obj 53 121 s insamprate;
#X obj 19 171 soundfiler;
#X msg 19 147 read -resize \$1 sample;
#X obj 19 201 s insamplength;
#X msg 357 197 \; sample resize 220500 \; insamplength 220500;
#X connect 1 0 2 0;
#X connect 2 0 5 0;
#X connect 2 1 3 0;
#X connect 4 0 6 0;
#X connect 5 0 4 0;
#X restore 336 350 pd insample;
#X floatatom 134 363 0 0 0 0 - - -;
#N canvas 190 43 405 461 test-signal 0;
#X obj 135 296 tabread4~ sample;
#X obj 135 271 line~;
#X obj 95 146 f;
#X obj 254 46 r insamprate;
#X obj 136 350 *~;
#X obj 171 350 dbtorms;
#X obj 171 327 inlet;
#X obj 135 415 outlet~;
#X obj 146 33 r insamplength;
#X msg 134 247 0 \, \$1 \$2;
#X obj 134 221 pack 0 0;
#X obj 209 190 /;
#X obj 299 99 * 0.001;
#X obj 135 388 hip~ 5;
#X obj 33 5 loadbang;
#X text 242 13 sample playback;
#X msg 33 25 1;
#X obj 33 69 metro 1000;
#X floatatom 33 48 0 0 0 0 - - -;
#X obj 255 75 t b b f;
#X obj 161 84 t b f;
#X connect 0 0 4 0;
#X connect 1 0 0 0;
#X connect 2 0 10 0;
#X connect 3 0 19 0;
#X connect 4 0 13 0;
#X connect 5 0 4 1;
#X connect 6 0 5 0;
#X connect 8 0 20 0;
#X connect 9 0 1 0;
#X connect 10 0 9 0;
#X connect 11 0 10 1;
#X connect 11 0 17 1;
#X connect 12 0 11 1;
#X connect 13 0 7 0;
#X connect 14 0 16 0;
#X connect 16 0 18 0;
#X connect 17 0 2 0;
#X connect 18 0 17 0;
#X connect 19 0 16 0;
#X connect 19 1 11 0;
#X connect 19 2 12 0;
#X connect 20 0 16 0;
#X connect 20 1 11 0;
#X connect 20 1 2 1;
#X restore 134 386 pd test-signal;
#X text 135 341 amplitude;
#X text 212 174 read a sample;
#X msg 136 193 \; read-sample ../sound/bell.aiff 44100;
#X text 12 97 The active ingredient is "pique" in the "analysis" subwindow
\, which is in the "extras" directory in the Pd release.;
#X msg 136 230 \; read-sample ../sound/voice.wav 32000;
#X obj 458 295 tabwrite~ sample;
#X obj 720 274 tgl 15 0 empty empty empty 0 -6 0 8 -262144 -1 -1 1
1;
#X msg 136 268 \; read-sample ../sound/voice2.wav;
#X connect 0 0 36 0;
#X connect 1 0 2 0;
#X connect 2 0 5 0;
#X connect 3 0 1 0;
#X connect 5 0 6 0;
#X connect 5 0 6 1;
#X connect 7 0 36 0;
#X connect 9 0 3 0;
#X connect 10 0 8 0;
#X connect 18 0 20 0;
#X connect 19 0 18 0;
#X connect 21 0 19 0;
#X connect 29 0 30 0;
#X connect 30 0 4 0;
#X connect 30 0 5 1;
#X connect 37 0 17 0;