aboutsummaryrefslogtreecommitdiff
path: root/pvgrain~-help.pd
blob: a1cdb205d8b2c2ab27b5750a50df7b9d50869364 (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
#N canvas 772 607 490 340 10;
#N canvas 0 22 482 332 pvgrain-block 0;
#X obj 9 110 outlet;
#X obj 9 15 inlet~;
#X obj 94 15 inlet;
#X obj 8 140 block~ 256;
#X text 12 90 args: grains/frame \, odds \, topfreq \, overlap \, window-factor
;
#X obj 9 68 pvgrain~ 4 0.01 2000 4 2;
#X connect 1 0 5 0;
#X connect 2 0 5 0;
#X connect 5 0 0 0;
#X restore 13 103 pd pvgrain-block;
#X obj 220 158 dac~;
#X obj 13 172 print;
#X msg 110 242 \; pd dsp \$1;
#X obj 110 221 tgl 15 0 empty empty empty 0 -6 0 8 -262144 -1 -1 0
1;
#N canvas 368 141 902 629 messages 0;
#X obj 111 523 outlet;
#X msg 105 115 probability \$1;
#X obj 108 68 hsl 128 15 0 0.1 0 0 empty empty empty -2 -6 0 8 -43542
-1 -1 1270 1;
#X floatatom 105 94 5 0 0 0 - - -;
#X obj 198 179 hsl 128 15 200 10000 0 0 empty empty empty -2 -6 0 8
-43542 -1 -1 2333 1;
#X floatatom 195 205 5 0 0 0 - - -;
#X msg 195 226 topfreq \$1;
#X obj 439 388 hsl 128 15 0 20 0 0 empty empty empty -2 -6 0 8 -43542
-1 -1 5080 1;
#X floatatom 436 414 5 0 0 0 - - -;
#X msg 436 435 framegrains \$1;
#X obj 105 1 loadbang;
#X obj 283 284 hsl 128 15 0 1500 0 0 empty empty empty -2 -6 0 8 -43542
-1 -1 423 1;
#X floatatom 280 310 5 0 0 0 - - -;
#X msg 280 331 bottomfreq \$1;
#X obj 105 40 unpack f f f f;
#X msg 105 21 0.01 2000 50 8;
#X obj 300 492 fftease-system;
#X text 436 363 maximum data grains per FFT frame;
#X text 197 157 top frequency to listen to in source sound;
#X text 283 263 ditto for bottom frequency;
#X text 221 48 odds for a grain appearing from an active bin;
#X connect 1 0 0 0;
#X connect 2 0 3 0;
#X connect 3 0 1 0;
#X connect 4 0 5 0;
#X connect 5 0 6 0;
#X connect 6 0 0 0;
#X connect 7 0 8 0;
#X connect 8 0 9 0;
#X connect 9 0 0 0;
#X connect 10 0 15 0;
#X connect 11 0 12 0;
#X connect 12 0 13 0;
#X connect 13 0 0 0;
#X connect 14 0 2 0;
#X connect 14 1 4 0;
#X connect 14 2 11 0;
#X connect 14 3 7 0;
#X connect 15 0 14 0;
#X connect 16 0 0 0;
#X restore 120 62 pd messages;
#X obj 50 129 tgl 15 0 empty empty empty 0 -6 0 8 -262144 -1 -1 0 1
;
#X obj 13 149 spigot;
#X text 69 131 see amp/freq info;
#X text 42 277 spectral granular (re)synthesis;
#N canvas 0 22 478 328 resynth-engine 0;
#X obj 12 28 inlet;
#N canvas 0 22 450 300 graph1 0;
#X array piano-sample 46383 float 2;
#X coords 0 1 46382 -1 200 140 1;
#X restore 215 4 graph;
#X obj 17 242 soundfiler;
#X msg 17 205 read -resize examples/Piano.aif piano-sample;
#X obj 17 169 loadbang;
#N canvas 578 40 566 745 choir 0;
#X obj 79 103 inlet;
#X obj 79 141 t l b;
#X obj 25 199 float;
#X obj 25 228 + 1;
#X obj 25 252 % 8;
#X floatatom 25 276 5 0 0 0 - - -;
#X obj 47 367 pack f f f;
#X obj 79 315 unpack f f;
#X obj 47 395 route 0 1 2 3 4 5 6 7;
#X obj 112 343 / 261;
#X text 156 345 <- piano sample base frequency;
#N canvas 74 88 1066 749 playit 0;
#X obj 21 47 unpack f f;
#X obj 21 222 outlet~;
#X floatatom 131 120 5 0 0 0 - - -;
#X floatatom 88 118 5 0 0 0 - - -;
#X obj 21 119 impulse~;
#X obj 21 146 *~;
#X obj 21 80 t b f;
#X obj 21 182 player~ piano-sample;
#X obj 21 8 inlet;
#X connect 0 0 6 0;
#X connect 0 1 2 0;
#X connect 2 0 7 1;
#X connect 3 0 5 1;
#X connect 4 0 5 0;
#X connect 5 0 7 0;
#X connect 6 0 4 0;
#X connect 6 1 3 0;
#X connect 7 0 1 0;
#X connect 8 0 0 0;
#X restore 47 430 pd playit;
#X obj 123 595 outlet~;
#X obj 123 572 *~ 0.25;
#N canvas 74 88 1062 745 playit 0;
#X obj 21 47 unpack f f;
#X obj 21 222 outlet~;
#X floatatom 131 120 5 0 0 0 - - -;
#X floatatom 88 118 5 0 0 0 - - -;
#X obj 21 119 impulse~;
#X obj 21 146 *~;
#X obj 21 80 t b f;
#X obj 21 182 player~ piano-sample;
#X obj 21 8 inlet;
#X connect 0 0 6 0;
#X connect 0 1 2 0;
#X connect 2 0 7 1;
#X connect 3 0 5 1;
#X connect 4 0 5 0;
#X connect 5 0 7 0;
#X connect 6 0 4 0;
#X connect 6 1 3 0;
#X connect 7 0 1 0;
#X connect 8 0 0 0;
#X restore 64 451 pd playit;
#N canvas 74 88 1062 745 playit 0;
#X obj 21 47 unpack f f;
#X obj 21 222 outlet~;
#X floatatom 131 120 5 0 0 0 - - -;
#X floatatom 88 118 5 0 0 0 - - -;
#X obj 21 119 impulse~;
#X obj 21 146 *~;
#X obj 21 80 t b f;
#X obj 21 182 player~ piano-sample;
#X obj 21 8 inlet;
#X connect 0 0 6 0;
#X connect 0 1 2 0;
#X connect 2 0 7 1;
#X connect 3 0 5 1;
#X connect 4 0 5 0;
#X connect 5 0 7 0;
#X connect 6 0 4 0;
#X connect 6 1 3 0;
#X connect 7 0 1 0;
#X connect 8 0 0 0;
#X restore 83 472 pd playit;
#N canvas 74 88 1062 745 playit 0;
#X obj 21 47 unpack f f;
#X obj 21 222 outlet~;
#X floatatom 131 120 5 0 0 0 - - -;
#X floatatom 88 118 5 0 0 0 - - -;
#X obj 21 119 impulse~;
#X obj 21 146 *~;
#X obj 21 80 t b f;
#X obj 21 182 player~ piano-sample;
#X obj 21 8 inlet;
#X connect 0 0 6 0;
#X connect 0 1 2 0;
#X connect 2 0 7 1;
#X connect 3 0 5 1;
#X connect 4 0 5 0;
#X connect 5 0 7 0;
#X connect 6 0 4 0;
#X connect 6 1 3 0;
#X connect 7 0 1 0;
#X connect 8 0 0 0;
#X restore 101 493 pd playit;
#N canvas 74 88 1062 745 playit 0;
#X obj 21 47 unpack f f;
#X obj 21 222 outlet~;
#X floatatom 131 120 5 0 0 0 - - -;
#X floatatom 88 118 5 0 0 0 - - -;
#X obj 21 119 impulse~;
#X obj 21 146 *~;
#X obj 21 80 t b f;
#X obj 21 182 player~ piano-sample;
#X obj 21 8 inlet;
#X connect 0 0 6 0;
#X connect 0 1 2 0;
#X connect 2 0 7 1;
#X connect 3 0 5 1;
#X connect 4 0 5 0;
#X connect 5 0 7 0;
#X connect 6 0 4 0;
#X connect 6 1 3 0;
#X connect 7 0 1 0;
#X connect 8 0 0 0;
#X restore 118 421 pd playit;
#N canvas 74 88 1062 745 playit 0;
#X obj 21 47 unpack f f;
#X obj 21 222 outlet~;
#X floatatom 131 120 5 0 0 0 - - -;
#X floatatom 88 118 5 0 0 0 - - -;
#X obj 21 119 impulse~;
#X obj 21 146 *~;
#X obj 21 80 t b f;
#X obj 21 182 player~ piano-sample;
#X obj 21 8 inlet;
#X connect 0 0 6 0;
#X connect 0 1 2 0;
#X connect 2 0 7 1;
#X connect 3 0 5 1;
#X connect 4 0 5 0;
#X connect 5 0 7 0;
#X connect 6 0 4 0;
#X connect 6 1 3 0;
#X connect 7 0 1 0;
#X connect 8 0 0 0;
#X restore 135 442 pd playit;
#N canvas 74 88 1062 745 playit 0;
#X obj 21 47 unpack f f;
#X obj 21 222 outlet~;
#X floatatom 131 120 5 0 0 0 - - -;
#X floatatom 88 118 5 0 0 0 - - -;
#X obj 21 119 impulse~;
#X obj 21 146 *~;
#X obj 21 80 t b f;
#X obj 21 182 player~ piano-sample;
#X obj 21 8 inlet;
#X connect 0 0 6 0;
#X connect 0 1 2 0;
#X connect 2 0 7 1;
#X connect 3 0 5 1;
#X connect 4 0 5 0;
#X connect 5 0 7 0;
#X connect 6 0 4 0;
#X connect 6 1 3 0;
#X connect 7 0 1 0;
#X connect 8 0 0 0;
#X restore 154 463 pd playit;
#N canvas 74 88 1062 745 playit 0;
#X obj 21 47 unpack f f;
#X obj 21 222 outlet~;
#X floatatom 131 120 5 0 0 0 - - -;
#X floatatom 88 118 5 0 0 0 - - -;
#X obj 21 119 impulse~;
#X obj 21 146 *~;
#X obj 21 80 t b f;
#X obj 21 182 player~ piano-sample;
#X obj 21 8 inlet;
#X connect 0 0 6 0;
#X connect 0 1 2 0;
#X connect 2 0 7 1;
#X connect 3 0 5 1;
#X connect 4 0 5 0;
#X connect 5 0 7 0;
#X connect 6 0 4 0;
#X connect 6 1 3 0;
#X connect 7 0 1 0;
#X connect 8 0 0 0;
#X restore 172 484 pd playit;
#X connect 0 0 1 0;
#X connect 1 0 7 0;
#X connect 1 1 2 0;
#X connect 2 0 3 0;
#X connect 3 0 4 0;
#X connect 4 0 2 1;
#X connect 4 0 5 0;
#X connect 5 0 6 0;
#X connect 6 0 8 0;
#X connect 7 0 6 1;
#X connect 7 1 9 0;
#X connect 8 0 11 0;
#X connect 8 1 14 0;
#X connect 8 2 15 0;
#X connect 8 3 16 0;
#X connect 8 4 17 0;
#X connect 8 5 18 0;
#X connect 8 6 19 0;
#X connect 8 7 20 0;
#X connect 9 0 6 2;
#X connect 11 0 13 0;
#X connect 13 0 12 0;
#X connect 14 0 13 0;
#X connect 15 0 13 0;
#X connect 16 0 13 0;
#X connect 17 0 13 0;
#X connect 18 0 13 0;
#X connect 19 0 13 0;
#X connect 20 0 13 0;
#X restore 12 97 pd choir;
#X obj 12 121 outlet~;
#X text 13 269 this is one example of what you can do with the analysis
data;
#X obj 12 63 spigot;
#X obj 49 44 inlet;
#X obj 113 27 loadbang;
#X msg 113 47 0;
#X connect 0 0 8 0;
#X connect 3 0 2 0;
#X connect 4 0 3 0;
#X connect 5 0 6 0;
#X connect 8 0 5 0;
#X connect 9 0 8 1;
#X connect 10 0 11 0;
#X connect 11 0 8 1;
#X restore 220 119 pd resynth-engine;
#N canvas 408 408 482 332 sound-source 0;
#X obj -34 240 outlet~;
#X obj -34 215 *~ 0.3;
#X floatatom -34 72 5 0 0 0 - - -;
#X obj 149 119 * 1.5;
#X floatatom 51 142 5 0 0 0 - - -;
#X floatatom 149 143 5 0 0 0 - - -;
#X obj 51 161 phasor~ 586.6;
#X obj 149 161 phasor~ 660;
#X obj -34 161 phasor~ 440;
#X obj 51 119 * 1.25;
#X msg -34 41 440;
#X obj -34 15 loadbang;
#X text -18 262 a soundfile or live mic would be more interesting here
;
#X connect 1 0 0 0;
#X connect 2 0 3 0;
#X connect 2 0 8 0;
#X connect 2 0 9 0;
#X connect 3 0 5 0;
#X connect 4 0 6 0;
#X connect 5 0 7 0;
#X connect 6 0 1 0;
#X connect 7 0 1 0;
#X connect 8 0 1 0;
#X connect 9 0 4 0;
#X connect 10 0 2 0;
#X connect 11 0 10 0;
#X restore 13 41 pd sound-source;
#N canvas 180 51 470 320 what's-going-on-here? 0;
#X text 18 26 Input sound is analyzed and a certain number of bin snapshots
are taken \, based on the probability and framegrains parameters. Each
bin grain snapshot is sent out as a list with two members: [amplitude
\, frequency]. In this example the grain data is used to drive a sample
player. One could easily replace this with a synth or even drive an
external MIDI synth. This is something like a pitch-follower except
that it follows the entire spectrum (limited by the topfreq parameter)
rather than just looking for the fundamental. Since this is based on
FFT analysis the resolution is worse for lower frequencies. Frequency
resolution can be improved by upping the FFT size.;
#X restore 269 203 pd what's-going-on-here?;
#X obj 334 96 tgl 15 0 empty empty empty 0 -6 0 8 -262144 -1 -1 1 1
;
#X text 356 98 <- turn me on;
#X text 204 64 <- check me out;
#X connect 0 0 7 0;
#X connect 0 0 10 0;
#X connect 4 0 3 0;
#X connect 5 0 0 1;
#X connect 6 0 7 1;
#X connect 7 0 2 0;
#X connect 10 0 1 0;
#X connect 10 0 1 1;
#X connect 11 0 0 0;
#X connect 13 0 10 1;