aboutsummaryrefslogtreecommitdiff
path: root/pd/doc/4.data.structures/14.sinedecomposer.pd
blob: 1d240ce752367275d9cf272fba48fd1ad3788846 (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
#N struct peak-template float x float y float amp float ampreal float
ampimag;
#N canvas 303 216 854 536 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 135 412 pd fft;
#X obj 30 408 *~;
#X obj 476 231 adc~;
#N canvas 204 36 521 368 analysis 0;
#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 6.52298 330 -195.561 0.0125191 -0.0131689 \;
;
#X scalar peak-template 13.0656 330 -262.841 0.222392 0.0909196 \;
;
#X scalar peak-template 26.2816 330 -188.229 0.0133818 0.00299871 \;
;
#X scalar peak-template 34.1579 330 -182.784 -0.0111106 0.000616574
\;;
#X scalar peak-template 39.2398 330 -192.587 0.00649353 -0.0148522
\;;
#X scalar peak-template 54.2567 330 -169.462 -0.00637704 0.00196744
\;;
#X scalar peak-template 64.6374 330 -153.343 -0.00231745 -0.00274854
\;;
#X scalar peak-template 70.731 330 -228.984 -0.0391646 -0.0525299 \;
;
#X scalar peak-template 83.4018 330 -157.354 0.00213705 0.00360794
\;;
#X scalar peak-template 89.0428 330 -164.547 0.00509053 0.00215158
\;;
#X scalar peak-template 96.8527 330 -127.029 0.00018868 -0.00129597
\;;
#X scalar peak-template 108.145 330 -206.524 -0.0244265 0.0130057 \;
;
#X scalar peak-template 119.672 330 -139.871 0.000310867 0.00212115
\;;
#X scalar peak-template 129.195 330 -154.988 0.00101519 -0.00369247
\;;
#X scalar peak-template 148.144 330 -131.59 -0.000488336 0.00148172
\;;
#X scalar peak-template 156.394 330 -157.846 0.00107442 -0.00413614
\;;
#X scalar peak-template 168.637 330 -126.924 0.0001938 -0.00128991
\;;
#X scalar peak-template 189.884 330 -119.499 0.000252664 -0.000947853
\;;
#X scalar peak-template 211.047 330 -130.949 0.000525129 0.0014288
\;;
#X restore 339 426 pd peak-list;
#X msg 38 192 \; pd dsp 1;
#X obj 720 296 s loud;
#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 155948 float 0;
#X coords 0 1 155947 -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;
#N canvas 186 103 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 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 10 0;
#X connect 1 0 0 0;
#X connect 2 0 7 0;
#X connect 3 0 16 0;
#X connect 5 0 17 0;
#X connect 6 0 1 0;
#X connect 7 0 6 0;
#X connect 8 0 7 1;
#X connect 8 0 14 1;
#X connect 9 0 8 1;
#X connect 10 0 4 0;
#X connect 11 0 13 0;
#X connect 13 0 15 0;
#X connect 14 0 2 0;
#X connect 15 0 14 0;
#X connect 16 0 13 0;
#X connect 16 1 8 0;
#X connect 16 2 9 0;
#X connect 17 0 13 0;
#X connect 17 1 8 0;
#X connect 17 1 2 1;
#X restore 135 389 pd test-signal;
#X text 136 317 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 0
1;
#X msg 136 268 \; read-sample ../sound/voice2.wav;
#X obj 29 435 output~;
#X connect 0 0 29 0;
#X connect 1 0 2 0;
#X connect 2 0 5 0;
#X connect 3 0 1 0;
#X connect 5 0 32 0;
#X connect 5 0 32 1;
#X connect 6 0 29 0;
#X connect 8 0 3 0;
#X connect 9 0 7 0;
#X connect 23 0 4 0;
#X connect 23 0 5 1;
#X connect 30 0 16 0;