diff options
Diffstat (limited to 's-freqnoise~.pd')
-rw-r--r-- | s-freqnoise~.pd | 192 |
1 files changed, 192 insertions, 0 deletions
diff --git a/s-freqnoise~.pd b/s-freqnoise~.pd new file mode 100644 index 0000000..d5ef4a6 --- /dev/null +++ b/s-freqnoise~.pd @@ -0,0 +1,192 @@ +#N canvas 62 67 878 612 10; +#N canvas 265 48 643 640 fft-analysis 0; +#X obj 15 164 *~; +#X obj 14 99 inlet~; +#X obj 15 218 rfft~; +#X obj 36 140 tabreceive~ \$0-hann; +#X obj 14 353 *~; +#X obj 56 353 *~; +#X obj 15 8 block~ 512 4; +#X text 85 88 The inlet~ now re-uses 3/4 of the previous block \, along +with the 128 new samples.; +#X text 221 141 window function as before.; +#X obj 76 196 tabreceive~ \$0-gain; +#X obj 77 225 *~; +#X obj 16 506 *~; +#X obj 37 481 tabreceive~ \$0-hann; +#X obj 77 283 /~ 768; +#X text 98 301 divide by 3N/2 (factor of N because rfft and rifft aren't +normalized \, and 3/2 is the gain of overlap-4 reconstruction when +Hann window function is applied twice.); +#X text 120 216 Just to show we're doing something \, we multiply each +channel by a gain controlled by an array in the main window. The control +is quartic-scaled for easy editing.; +#X obj 78 251 *~; +#X text 92 357 Multiply the (complex-valued) spectrum amplitudes by +the (real-valued) gain-and-normalization-factor; +#X obj 15 399 rifft~; +#X text 89 396 Real-valued inverse Fourier transform. This uses only +the first N/@ points of its inputs \, supplying the rest by symmerty +(so it's OK that rfft~ obly puts out those N/2 points.) There's only +one outlet because the output is real-valued.; +#X obj 16 566 outlet~; +#X text 88 499 Multiply by the Hann window function again \, necessary +because the operation we performed might result in a signal that doesn't +go smoothly to zero at both ends.; +#X text 89 566 This repackages the output into 64-sample chunks for +the parent window. Since we're operating with an overlap \, the outlet~ +object performs an overlapped sum of the blocks computed in this window. +; +#X text 129 8 block~ object specifies vector size of 512 and overlap +four. This window now computes blocks of 512 samples at intervals of +128 samples computed on the parent patch.; +#X connect 0 0 2 0; +#X connect 1 0 0 0; +#X connect 2 0 4 0; +#X connect 2 1 5 0; +#X connect 3 0 0 1; +#X connect 4 0 18 0; +#X connect 5 0 18 1; +#X connect 9 0 10 0; +#X connect 9 0 10 1; +#X connect 10 0 16 0; +#X connect 10 0 16 1; +#X connect 11 0 20 0; +#X connect 12 0 11 1; +#X connect 13 0 4 1; +#X connect 13 0 5 1; +#X connect 16 0 13 0; +#X connect 18 0 11 0; +#X restore 26 383 pd fft-analysis; +#N canvas 35 66 592 433 Hann-window 0; +#N canvas 0 0 450 300 graph1 0; +#X array \$0-hann 512 float 0; +#X coords 0 1 511 0 200 120 1; +#X restore 293 249 graph; +#X msg 171 263 0; +#X obj 65 312 osc~; +#X obj 65 264 samplerate~; +#X obj 65 335 *~ -0.5; +#X obj 65 358 +~ 0.5; +#X obj 57 383 tabwrite~ \$0-hann; +#X text 279 241 1; +#X text 272 359 0; +#X text 288 372 0; +#X obj 65 288 / 512; +#X obj 57 241 bng 15 250 50 0 empty empty empty 0 -6 0 8 -262144 -1 +-1; +#X text 336 221 Hann window; +#X text 113 310 period 512; +#X text 90 215 recalculate Hann; +#X text 125 230 window table; +#X obj 57 146 loadbang; +#X msg 79 179 \; pd dsp 1; +#X text 40 27 The Hann window is now recomputed on 'loadbang' to make +the file smaller (it doesn't have to be saved with the array.); +#X text 474 375 511; +#X connect 1 0 2 1; +#X connect 2 0 4 0; +#X connect 3 0 10 0; +#X connect 4 0 5 0; +#X connect 5 0 6 0; +#X connect 10 0 2 0; +#X connect 11 0 3 0; +#X connect 11 0 1 0; +#X connect 11 0 6 0; +#X connect 16 0 11 0; +#X connect 16 0 17 0; +#X restore 224 359 pd Hann-window; +#X obj 25 264 noise~; +#N canvas 0 0 450 300 graph1 0; +#X array \$0-gain 257 float 2; +#X coords 0 5 256 -0.01 256 60 1; +#X restore 59 34 graph; +#X obj 27 411 outlet~; +#X obj 92 349 *~; +#X obj 8 40 tgl 14 1 \$0-noise \$0-noise noise 0 -6 0 8 -260818 -1 +-1 1 1; +#X obj 24 348 *~; +#X obj 93 264 inlet~; +#X obj 76 290 r \$0-noise; +#X obj 114 316 expr 1 - $f1; +#X obj 60 35 cnv 15 254 58 empty empty empty 20 12 0 14 -260818 -66577 +0; +#X obj 247 226 loadbang; +#X msg 247 254 const 0; +#X obj 247 283 s \$0-gain; +#X obj 580 90 r SSSAD_SAVE; +#X obj 602 265 list prepend; +#X obj 736 265 t l; +#X obj 580 294 list; +#X obj 602 208 f; +#X obj 602 180 until; +#X msg 647 156 0; +#X obj 648 208 + 1; +#X obj 602 237 tabread \$0-gain; +#X obj 580 116 t b b b; +#X obj 431 319 sssad/sssad \$1/fourier; +#X obj 431 365 until; +#X obj 431 450 list append; +#X obj 530 472 bang; +#X obj 431 472 list split 1; +#X obj 461 413 f; +#X obj 431 386 t b b; +#X msg 477 384 0; +#X obj 488 413 + 1; +#X obj 431 512 tabwrite \$0-gain; +#X obj 431 340 t b b l; +#X obj 626 430 sssad/sssad \$1/noise; +#X obj 761 408 r \$0-noise; +#X obj 626 452 s \$0-noise; +#X msg 602 156 256; +#X text 339 6 This is an almost exact copy of Miller's "Fourier Resynthesis" +example patch \, but GOPified and with some state saving ability using +Frank B's sssad. All the hard work was his \, all the mistakes are +mine. I just think it's the coolest sounding thing ever.; +#X msg 681 192 bang; +#X connect 0 0 4 0; +#X connect 2 0 7 0; +#X connect 5 0 0 0; +#X connect 7 0 0 0; +#X connect 8 0 5 0; +#X connect 9 0 10 0; +#X connect 9 0 7 1; +#X connect 10 0 5 1; +#X connect 12 0 13 0; +#X connect 13 0 14 0; +#X connect 15 0 24 0; +#X connect 16 0 17 0; +#X connect 16 0 18 1; +#X connect 17 0 16 1; +#X connect 18 0 25 1; +#X connect 19 0 22 0; +#X connect 19 0 23 0; +#X connect 20 0 19 0; +#X connect 21 0 19 1; +#X connect 21 0 41 0; +#X connect 22 0 19 1; +#X connect 23 0 16 0; +#X connect 24 0 18 0; +#X connect 24 1 39 0; +#X connect 24 2 21 0; +#X connect 25 0 35 0; +#X connect 26 0 31 0; +#X connect 27 0 29 0; +#X connect 28 0 26 1; +#X connect 29 0 34 0; +#X connect 29 1 27 1; +#X connect 29 2 28 0; +#X connect 30 0 33 0; +#X connect 30 0 34 1; +#X connect 31 0 27 0; +#X connect 31 1 30 0; +#X connect 32 0 30 1; +#X connect 33 0 30 1; +#X connect 35 0 26 0; +#X connect 35 1 32 0; +#X connect 35 2 27 1; +#X connect 36 0 38 0; +#X connect 37 0 36 1; +#X connect 39 0 20 0; +#X connect 41 0 16 1; +#X coords 0 -1 1 1 320 100 1 0 0; |