diff options
author | Guenter Geiger <ggeiger@users.sourceforge.net> | 2002-07-29 17:06:19 +0000 |
---|---|---|
committer | Guenter Geiger <ggeiger@users.sourceforge.net> | 2002-07-29 17:06:19 +0000 |
commit | 57045df5fe3ec557e57dc7434ac1a07b5521bffc (patch) | |
tree | 7174058b41b73c808107c7090d9a4e93ee202341 /pd/doc/4.fft.examples/14.waveformgrab.pd | |
parent | da38b3424229e59f956252c3d89895e43e84e278 (diff) |
This commit was generated by cvs2svn to compensate for changes in r58,
which included commits to RCS files with non-trunk default branches.
svn path=/trunk/; revision=59
Diffstat (limited to 'pd/doc/4.fft.examples/14.waveformgrab.pd')
-rw-r--r-- | pd/doc/4.fft.examples/14.waveformgrab.pd | 385 |
1 files changed, 385 insertions, 0 deletions
diff --git a/pd/doc/4.fft.examples/14.waveformgrab.pd b/pd/doc/4.fft.examples/14.waveformgrab.pd new file mode 100644 index 00000000..a9d17bed --- /dev/null +++ b/pd/doc/4.fft.examples/14.waveformgrab.pd @@ -0,0 +1,385 @@ +#N canvas 59 19 701 580 12; +#X msg 415 337 set \$1; +#X floatatom 596 337; +#N canvas 81 37 483 329 fft 0; +#X obj 102 155 *~; +#X obj 70 155 *~; +#X obj 70 98 *~; +#X obj 70 52 inlet~; +#X obj 70 127 rfft~; +#X obj 70 182 sqrt~; +#X obj 70 209 *~; +#X obj 70 261 rifft~; +#X obj 70 287 tabwrite~ grab; +#X obj 86 74 tabreceive~ half-sine; +#X obj 70 235 /~ 512; +#X obj 137 191 tabreceive~ alternator; +#X obj 162 259 r do-grab; +#X obj 368 310 block~ 1024 2; +#X connect 0 0 5 0; +#X connect 1 0 5 0; +#X connect 2 0 4 0; +#X connect 3 0 2 0; +#X connect 4 0 1 0; +#X connect 4 0 1 1; +#X connect 4 1 0 0; +#X connect 4 1 0 1; +#X connect 5 0 6 0; +#X connect 6 0 10 0; +#X connect 7 0 8 0; +#X connect 9 0 2 1; +#X connect 10 0 7 0; +#X connect 11 0 6 1; +#X connect 12 0 8 0; +#X restore 186 422 pd fft; +#X floatatom 511 360; +#X floatatom 415 360; +#X obj 186 398 hip~ 5; +#X obj 99 544 dac~; +#N canvas 0 0 600 273 in-sample 0; +#X graph graph1 0 -1 440999 1 160 166 560 16; +#X array grab 441000 float; +#X pop; +#X msg 186 208 \; grab resize 441000; +#X obj 38 224 soundfiler; +#X msg 38 191 write x.wav grab; +#X msg 353 212 \; grab resize 4410; +#X connect 3 0 2 0; +#X restore 371 446 pd in-sample; +#X obj 116 491 hip~ 5; +#X obj 99 515 *~; +#N canvas 59 0 781 602 regenerate 0; +#X obj 90 400 r invblk; +#X obj 50 463 *~; +#X obj 67 443 clip~ 1 1000; +#X floatatom 31 41; +#X floatatom 221 117; +#X obj 430 368 *~; +#X obj 558 345 samphold~; +#X obj 672 345 samphold~; +#X obj 467 345 samphold~; +#X obj 446 493 clip~ -0.5 0.5; +#X obj 446 516 cos~; +#X obj 674 389 +~; +#X obj 565 443 -~; +#X obj 550 463 *~; +#X obj 602 491 +~; +#X obj 585 558 *~; +#X obj 37 373 *~; +#X obj 169 338 samphold~; +#X obj 311 343 samphold~; +#X obj 116 181 sig~; +#X obj 221 230 phasor~; +#X obj 330 180 wrap~; +#X obj 221 92 r pitch; +#X obj 221 161 mtof; +#X obj 116 157 r sample-rate; +#X obj 314 156 line~; +#X text 360 153 read location in blocks; +#X obj 314 234 -~; +#X text 374 179 fractional part; +#X text 338 234 integer part; +#X text 71 128 spectral stretch; +#X obj 66 335 samphold~; +#X obj 319 256 sig~ 0.5; +#X text 294 357 middle of block; +#X obj 413 34 t b f; +#X obj 413 80 /; +#X obj 413 56 1; +#X obj 51 488 clip~ -0.5 0.5; +#X obj 51 510 cos~; +#X obj 294 396 +~; +#X obj 173 450 -~; +#X obj 155 471 *~; +#X obj 162 494 +~; +#X obj 145 550 *~; +#X text 68 365 offset into; +#X text 78 376 sample; +#X text 128 243 samples; +#X text 128 228 period in; +#X text 175 353 weight for; +#X text 174 364 next block; +#X obj 640 193 wrap~; +#X obj 413 102 s invblk; +#X text 411 118 one over block size; +#X obj 483 406 r invblk; +#X obj 145 574 send~ outsig; +#X floatatom 328 87; +#X obj 328 112 pack 0 100; +#X obj 413 11 r window-size; +#X obj 454 239 r window-size; +#X obj 31 17 r specshift; +#X text 103 270 grain size in samples; +#X obj 314 37 r loco; +#X obj 444 472 *~; +#X obj 460 450 clip~ 1 1000; +#X text 91 347 grain; +#X obj 221 141 - 12; +#X obj 173 421 tabread4~ grab; +#X obj 294 422 tabread4~ grab; +#X obj 565 414 tabread4~ grab; +#X obj 674 415 tabread4~ grab; +#X obj 31 64 * 0.01; +#X obj 31 88 + 69; +#X obj 31 111 mtof; +#X obj 31 134 / 440; +#X obj 70 272 *~ 1; +#X obj 640 168 +~ 0.5; +#X obj 67 422 *~ 1; +#X obj 460 429 *~ 1; +#X obj 446 538 +~ 1; +#X obj 51 533 +~ 1; +#X obj 116 208 /~ 1; +#X obj 314 282 *~ 1; +#X obj 173 398 +~ 0; +#X obj 565 392 +~ 0; +#X obj 16 334 -~ 0.5; +#X obj 413 345 -~ 0.5; +#X msg 328 64 set \$1; +#X connect 0 0 76 1; +#X connect 1 0 37 0; +#X connect 2 0 1 1; +#X connect 3 0 70 0; +#X connect 4 0 65 0; +#X connect 5 0 11 0; +#X connect 6 0 13 0; +#X connect 7 0 11 1; +#X connect 8 0 5 1; +#X connect 8 0 77 0; +#X connect 9 0 10 0; +#X connect 10 0 78 0; +#X connect 11 0 69 0; +#X connect 11 0 83 0; +#X connect 12 0 13 1; +#X connect 13 0 14 0; +#X connect 14 0 15 1; +#X connect 15 0 54 0; +#X connect 16 0 39 0; +#X connect 17 0 41 0; +#X connect 18 0 39 1; +#X connect 19 0 80 0; +#X connect 20 0 31 1; +#X connect 20 0 18 1; +#X connect 20 0 17 1; +#X connect 20 0 75 0; +#X connect 20 0 84 0; +#X connect 21 0 27 1; +#X connect 21 0 17 0; +#X connect 21 0 6 0; +#X connect 22 0 4 0; +#X connect 23 0 20 0; +#X connect 23 0 80 1; +#X connect 24 0 19 0; +#X connect 25 0 21 0; +#X connect 25 0 27 0; +#X connect 27 0 81 0; +#X connect 31 0 16 1; +#X connect 31 0 76 0; +#X connect 32 0 81 0; +#X connect 34 0 36 0; +#X connect 34 1 35 1; +#X connect 35 0 51 0; +#X connect 36 0 35 0; +#X connect 37 0 38 0; +#X connect 38 0 79 0; +#X connect 39 0 67 0; +#X connect 39 0 82 0; +#X connect 40 0 41 1; +#X connect 41 0 42 0; +#X connect 42 0 43 1; +#X connect 43 0 54 0; +#X connect 50 0 8 1; +#X connect 50 0 6 1; +#X connect 50 0 7 1; +#X connect 50 0 85 0; +#X connect 53 0 77 1; +#X connect 55 0 56 0; +#X connect 56 0 25 0; +#X connect 57 0 34 0; +#X connect 58 0 81 1; +#X connect 58 0 82 1; +#X connect 58 0 83 1; +#X connect 59 0 3 0; +#X connect 61 0 25 0; +#X connect 61 0 86 0; +#X connect 62 0 9 0; +#X connect 63 0 62 1; +#X connect 65 0 23 0; +#X connect 66 0 40 0; +#X connect 67 0 40 1; +#X connect 67 0 42 1; +#X connect 68 0 12 0; +#X connect 69 0 12 1; +#X connect 69 0 14 1; +#X connect 70 0 71 0; +#X connect 71 0 72 0; +#X connect 72 0 73 0; +#X connect 73 0 74 1; +#X connect 74 0 31 0; +#X connect 74 0 8 0; +#X connect 75 0 50 0; +#X connect 76 0 2 0; +#X connect 77 0 63 0; +#X connect 78 0 15 0; +#X connect 79 0 43 0; +#X connect 80 0 74 0; +#X connect 81 0 18 0; +#X connect 81 0 7 0; +#X connect 82 0 66 0; +#X connect 83 0 68 0; +#X connect 84 0 16 0; +#X connect 84 0 1 0; +#X connect 85 0 5 0; +#X connect 85 0 62 0; +#X connect 86 0 55 0; +#X restore 371 495 pd regenerate; +#X obj 115 464 receive~ outsig; +#X obj 43 467 line~; +#X obj 416 383 s specshift; +#X obj 575 386 s loco; +#X obj 512 383 s pitch; +#X obj 511 319 r pitch; +#X msg 511 339 set \$1; +#X obj 415 317 r specshift; +#X floatatom 553 64; +#N canvas 194 37 397 591 output 0; +#X obj 58 180 t b; +#X obj 58 135 f; +#X obj 58 90 inlet; +#X text 63 71 mute; +#X obj 58 202 f; +#X msg 119 217 0; +#X msg 58 113 bang; +#X obj 58 158 moses 1; +#X obj 119 194 t b f; +#X obj 86 392 outlet; +#X msg 86 370 set \$1; +#X obj 165 145 moses 1; +#X obj 199 394 dbtorms; +#X obj 199 417 pack 0 100; +#X obj 165 122 r master-lvl; +#X obj 86 339 r master-lvl; +#X obj 74 254 s master-lvl; +#X obj 199 439 s master-amp; +#X connect 0 0 4 0; +#X connect 1 0 7 0; +#X connect 2 0 6 0; +#X connect 4 0 16 0; +#X connect 5 0 16 0; +#X connect 6 0 1 0; +#X connect 7 0 0 0; +#X connect 7 1 8 0; +#X connect 8 0 5 0; +#X connect 10 0 9 0; +#X connect 11 1 4 1; +#X connect 12 0 13 0; +#X connect 13 0 17 0; +#X connect 14 0 1 1; +#X connect 14 0 11 0; +#X connect 15 0 10 0; +#X connect 15 0 12 0; +#X restore 553 42 pd output; +#X msg 553 19 mute; +#X text 587 57 MASTER; +#X text 586 69 LEVEL; +#X obj 553 86 s master-lvl; +#X obj 44 442 r master-amp; +#N canvas 93 44 649 449 window 0; +#X graph graph1 0 -1 1023 1 435 170 635 20; +#X array half-sine 1024 float; +#X pop; +#X obj 108 88 r window-size; +#X obj 108 110 t b f; +#X obj 72 136 /; +#X obj 25 16 r make-window; +#X msg 25 36 bang; +#X msg 109 136 -0.25; +#X obj 70 181 osc~; +#X obj 84 66 samplerate~; +#X graph graph2 0 -1 1023 1 439 331 639 191; +#X array alternator 1024 float; +#X pop; +#X obj 21 249 r make-window; +#X msg 21 269 bang; +#X obj 80 299 samplerate~; +#X obj 451 372 r window-size; +#X msg 451 397 \; half-sine resize \$1 \; alternator resize \$1; +#X obj 80 325 / 2; +#X obj 239 12 r make-window; +#X obj 80 351 phasor~; +#X obj 21 425 tabwrite~ alternator; +#X obj 256 106 switch~; +#X msg 239 70 1; +#X obj 277 44 del 500; +#X msg 277 70 0; +#X obj 80 373 -~ 0.5; +#X obj 25 224 tabwrite~ half-sine; +#X obj 72 160 / 2; +#X obj 80 396 *~ 4; +#X msg 124 325 0.75; +#X obj 68 203 *~; +#X connect 1 0 2 0; +#X connect 2 0 3 0; +#X connect 2 1 3 1; +#X connect 3 0 25 0; +#X connect 4 0 5 0; +#X connect 5 0 6 0; +#X connect 5 0 8 0; +#X connect 5 0 24 0; +#X connect 6 0 7 1; +#X connect 7 0 28 0; +#X connect 7 0 28 1; +#X connect 8 0 3 0; +#X connect 10 0 11 0; +#X connect 11 0 27 0; +#X connect 11 0 12 0; +#X connect 11 0 18 0; +#X connect 12 0 15 0; +#X connect 13 0 14 0; +#X connect 15 0 17 0; +#X connect 16 0 20 0; +#X connect 16 0 21 0; +#X connect 17 0 23 0; +#X connect 20 0 19 0; +#X connect 21 0 22 0; +#X connect 22 0 19 0; +#X connect 23 0 26 0; +#X connect 25 0 7 0; +#X connect 26 0 18 0; +#X connect 27 0 17 1; +#X connect 28 0 24 0; +#X restore 371 471 pd window; +#X obj 186 370 readsf~; +#X text 38 285 CLICK HERE FIRST; +#X msg 576 312 0 \, 250 10000; +#X msg 28 309 \; pd dsp 1 \; sample-rate 44100 \; window-size 1024 \; make-window bang \; pitch 48 \; specshift 0 \;; +#X obj 596 360 pack 0 100; +#X text 196 292 analyze from soundfile; +#X text 118 10 WAVEFORM GRABBER; +#X text 21 27 This patch takes an incoming sound does an overlap-2 FFT analysis of it \, and bashes the phases of the spectra to known values. In this way you can use samples as waveforms and cross-fade them at will without getting phase modulation.; +#X text 19 93 This might be useful for making synthetic instruments that mimic the spectral variation of recorded sounds. Here we analyze a soundfile \, but you can replace "readsf~" by "adc~" to analyze on the fly. The result is a massaged sample suitable for reading via the "regenerate" subpatch.; +#X text 18 169 Since the analysis is done with an overlap of 2 \, the analyzed sample is twice the length of the original sound.; +#X text 18 199 When you aren't busy doing analyses \, you can turn the "FFT" window off by replacing the block~ with a switch~.; +#X msg 186 322 open ../sound/voice.wav \, 1 \; specshift -720 \; do-grab bang; +#X text 15 231 The resynthesized sound seems to be skewed slightly north spectrally. The recorded sample should just need -530 cents of correction (because of the different sample rate) but my ears prefer -720; +#X connect 0 0 4 0; +#X connect 1 0 31 0; +#X connect 3 0 15 0; +#X connect 4 0 13 0; +#X connect 5 0 2 0; +#X connect 8 0 9 1; +#X connect 9 0 6 0; +#X connect 9 0 6 1; +#X connect 11 0 8 0; +#X connect 12 0 9 0; +#X connect 16 0 17 0; +#X connect 17 0 3 0; +#X connect 18 0 0 0; +#X connect 19 0 24 0; +#X connect 20 0 19 0; +#X connect 21 0 20 0; +#X connect 25 0 12 0; +#X connect 27 0 5 0; +#X connect 29 0 14 0; +#X connect 31 0 14 0; +#X connect 38 0 27 0; |