diff options
Diffstat (limited to 'pd/doc/4.fft.examples/05.sheepgoat.pd')
-rw-r--r-- | pd/doc/4.fft.examples/05.sheepgoat.pd | 395 |
1 files changed, 395 insertions, 0 deletions
diff --git a/pd/doc/4.fft.examples/05.sheepgoat.pd b/pd/doc/4.fft.examples/05.sheepgoat.pd new file mode 100644 index 00000000..255b2a14 --- /dev/null +++ b/pd/doc/4.fft.examples/05.sheepgoat.pd @@ -0,0 +1,395 @@ +#N canvas 69 23 831 481 12; +#X floatatom 189 254; +#N canvas 31 3 710 622 fft-analysis 0; +#X obj 58 523 *~; +#X obj 306 397 +~; +#X obj 264 397 +~; +#X obj 232 427 *~; +#X obj 197 427 *~; +#X obj 197 452 +~; +#X obj 197 477 sqrt~; +#X obj 528 342 *~; +#X obj 493 342 *~; +#X obj 493 367 +~; +#X obj 399 256 *~; +#X obj 269 147 *~; +#X obj 234 147 *~; +#X obj 199 147 *~; +#X obj 163 147 *~; +#X obj 163 172 +~; +#X obj 21 573 *~; +#X obj 368 141 *~; +#X obj 80 80 *~; +#X obj 71 289 *~; +#X obj 99 56 inlet~; +#X obj 6 289 *~; +#X obj 28 32 tabreceive~ hanning; +#X obj 80 105 rfft~; +#X obj 21 548 rifft~; +#X obj 21 597 outlet~; +#X text 34 16 Hanning window; +#X text 106 88 forward real FFT; +#X obj 333 141 *~; +#X obj 333 167 +~; +#X obj 43 263 sig~ 0.001; +#X obj 601 576 block~ 2048 4; +#X obj 271 51 tabreceive~ last-real; +#X text 368 23 previous analysis; +#X obj 449 51 tabreceive~ last-imag; +#X obj 333 192 rsqrt~; +#X text 388 192 inverse modulus; +#X obj 234 172 -~; +#X obj 347 256 *~; +#X text 435 254 encoded as a single complex number; +#X text 435 229 amplitude and phase change; +#X obj 165 240 *~; +#X obj 128 289 tabsend~ last-real; +#X obj 165 266 tabsend~ last-imag; +#X text 191 240 sic; +#X text 543 393 modulus; +#X obj 493 448 +~; +#X text 522 447 sum of moduli; +#X obj 493 393 sqrt~; +#X text 244 472 modulus of sum; +#X obj 197 503 /~; +#X obj 197 529 -~; +#X obj 197 554 *~; +#X obj 197 579 clip~ 0 1; +#X obj 83 321 r threshold; +#X obj 83 371 t b f; +#X obj 83 422 -; +#X msg 83 397 1; +#X obj 83 472 sig~; +#X obj 10 523 *~; +#X obj 251 509 sig~ 1.5e-20; +#X obj 350 512 r flip; +#X obj 350 538 sel 0; +#X msg 350 563 1e+20; +#X msg 395 563 -1e+20; +#X floatatom 83 447; +#X obj 83 346 / 100; +#X obj 136 373 lrshift~ 1; +#X obj 210 373 lrshift~ -1; +#X obj 331 373 lrshift~ 1; +#X obj 405 373 lrshift~ -1; +#X obj 510 419 lrshift~ 1; +#X obj 593 422 lrshift~ -1; +#X connect 0 0 24 1; +#X connect 1 0 3 0; +#X connect 1 0 3 1; +#X connect 2 0 4 0; +#X connect 2 0 4 1; +#X connect 3 0 5 1; +#X connect 4 0 5 0; +#X connect 5 0 6 0; +#X connect 6 0 50 0; +#X connect 7 0 9 1; +#X connect 8 0 9 0; +#X connect 9 0 48 0; +#X connect 10 0 7 1; +#X connect 10 0 1 0; +#X connect 10 0 7 0; +#X connect 10 0 69 0; +#X connect 10 0 70 0; +#X connect 11 0 37 1; +#X connect 12 0 37 0; +#X connect 13 0 15 1; +#X connect 14 0 15 0; +#X connect 15 0 38 0; +#X connect 16 0 25 0; +#X connect 17 0 29 1; +#X connect 18 0 23 0; +#X connect 19 0 0 0; +#X connect 20 0 18 1; +#X connect 21 0 59 0; +#X connect 22 0 16 1; +#X connect 22 0 18 0; +#X connect 23 0 12 0; +#X connect 23 0 14 0; +#X connect 23 0 42 0; +#X connect 23 0 21 0; +#X connect 23 1 13 0; +#X connect 23 1 11 0; +#X connect 23 1 43 0; +#X connect 23 1 19 0; +#X connect 24 0 16 0; +#X connect 28 0 29 0; +#X connect 29 0 35 0; +#X connect 30 0 21 1; +#X connect 30 0 19 1; +#X connect 32 0 14 1; +#X connect 32 0 11 1; +#X connect 32 0 28 0; +#X connect 32 0 28 1; +#X connect 34 0 13 1; +#X connect 34 0 12 1; +#X connect 34 0 17 0; +#X connect 34 0 17 1; +#X connect 35 0 10 1; +#X connect 35 0 38 1; +#X connect 35 0 41 0; +#X connect 37 0 10 0; +#X connect 38 0 8 0; +#X connect 38 0 8 1; +#X connect 38 0 2 1; +#X connect 38 0 67 0; +#X connect 38 0 68 0; +#X connect 41 0 43 0; +#X connect 41 0 42 0; +#X connect 46 0 50 1; +#X connect 48 0 46 0; +#X connect 48 0 71 0; +#X connect 48 0 72 0; +#X connect 50 0 51 0; +#X connect 51 0 52 0; +#X connect 52 0 53 0; +#X connect 53 0 0 1; +#X connect 53 0 59 1; +#X connect 54 0 66 0; +#X connect 55 0 57 0; +#X connect 55 1 56 1; +#X connect 56 0 65 0; +#X connect 57 0 56 0; +#X connect 58 0 51 1; +#X connect 59 0 24 0; +#X connect 60 0 50 1; +#X connect 61 0 62 0; +#X connect 62 0 63 0; +#X connect 62 1 64 0; +#X connect 63 0 52 1; +#X connect 64 0 52 1; +#X connect 65 0 58 0; +#X connect 66 0 55 0; +#X connect 67 0 2 0; +#X connect 68 0 2 0; +#X connect 69 0 1 1; +#X connect 70 0 1 1; +#X connect 71 0 46 1; +#X connect 72 0 46 1; +#X restore 106 400 pd fft-analysis; +#X obj 106 468 dac~; +#X obj 106 443 *~; +#N canvas 211 72 625 525 previous-analysis 0; +#X graph graph1 0 -1 2048 1 310 246 510 96; +#X array last-real 2048 float; +#X pop; +#X graph graph2 0 -1 2048 1 309 433 509 283; +#X array last-imag 2048 float; +#X pop; +#X msg 67 202 \; last-real resize 2048 \; last-imag resize 2048; +#X restore 649 457 pd previous-analysis; +#X obj 189 279 s threshold; +#X obj 149 468 line~; +#X floatatom 622 72; +#N canvas 194 37 397 591 output 0; +#X obj 66 202 t b; +#X obj 66 152 f; +#X obj 66 102 inlet; +#X text 71 80 mute; +#X obj 66 228 f; +#X msg 134 244 0; +#X msg 66 127 bang; +#X obj 66 177 moses 1; +#X obj 134 219 t b f; +#X obj 96 441 outlet; +#X msg 96 416 set \$1; +#X obj 185 163 moses 1; +#X obj 224 444 dbtorms; +#X obj 224 469 pack 0 100; +#X obj 185 138 r master-lvl; +#X obj 96 382 r master-lvl; +#X obj 83 285 s master-lvl; +#X obj 224 494 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 622 47 pd output; +#X msg 622 22 mute; +#X text 661 64 MASTER; +#X text 660 78 LEVEL; +#X obj 622 98 s master-lvl; +#X obj 149 443 r master-amp; +#X obj 571 310 loadbang; +#X obj 571 336 samplerate~; +#X text 27 215 click here first; +#X obj 470 364 hip~ 5; +#X obj 470 338 adc~ 1; +#X msg 535 306 bang; +#X obj 535 338 f; +#X obj 535 364 s insamprate; +#X obj 470 389 tabwrite~ sample; +#X text 476 279 record your own sample; +#N canvas 132 61 699 413 hanning-window 0; +#X obj 97 218 phasor~; +#X obj 97 247 cos~; +#X obj 24 347 tabwrite~ hanning; +#X obj 31 267 -~; +#X obj 30 231 sig~ 1; +#X msg 40 191 0; +#X text 149 14 CALCULATE HANNING; +#X text 149 29 WINDOW TABLE; +#X graph graph1 0 -1 2047 1 454 213 654 63; +#X array hanning 2048 float; +#X pop; +#X obj 98 139 / 1024; +#X obj 98 181 sig~; +#X text 185 156 sample rate / window size; +#X msg 24 152 bang; +#X obj 70 284 sig~ 0.5; +#X obj 52 318 *~; +#X obj 71 102 samplerate~; +#X obj 26 24 r window-size; +#X obj 26 56 t b f; +#X msg 468 265 \; hanning resize 2048; +#X connect 0 0 1 0; +#X connect 1 0 3 1; +#X connect 3 0 14 0; +#X connect 4 0 3 0; +#X connect 5 0 0 1; +#X connect 9 0 10 0; +#X connect 10 0 0 0; +#X connect 12 0 2 0; +#X connect 12 0 5 0; +#X connect 13 0 14 1; +#X connect 14 0 2 0; +#X connect 15 0 9 0; +#X connect 16 0 17 0; +#X connect 17 0 15 0; +#X connect 17 0 12 0; +#X connect 17 1 9 1; +#X restore 649 432 pd hanning-window; +#X text 190 0 PITCHED/UNPITCHED SEPARATION; +#X text 99 18 This is the first of two attempts to separate "pitched" sound from noisy sound. We perform the usual windowed FFT \, and estimate the frequency of the signal in each bin \, If a bin's frequency agrees with those of its two neighbors \, we conclude that that bin belongs to a "pitched" sound.; +#X floatatom 320 258; +#X obj 320 283 s flip; +#X msg 320 230 0; +#X text 324 192 select:; +#X text 293 211 pitched; +#X text 365 211 noisy; +#X msg 365 231 1; +#X text 182 204 threshold; +#X text 186 217 (range; +#X text 190 229 0-100); +#X text 97 90 A low threshold means to let only very coherent signals through. A high one permits more of the signal to be considered "pitched". You can select either to hear the pitched or the noisy part.; +#X text 97 147 You might agree with me that the subsequent patch works better than this one...; +#X msg 22 238 \; window-size 2048 \; flip 0 \; pd dsp 1; +#X floatatom 104 339; +#X text 184 316 noise; +#X text 125 296 amplitudes; +#X floatatom 191 340; +#N canvas 190 43 534 552 test-signal 0; +#X obj 134 293 tabread4~ sample; +#X obj 134 268 line~; +#X obj 95 146 f; +#X obj 184 123 r insamprate; +#X obj 320 380 *~; +#X obj 136 350 *~; +#X obj 323 261 noise~; +#X obj 136 397 +~; +#X obj 164 351 dbtorms; +#X obj 346 380 dbtorms; +#X obj 164 328 inlet; +#X obj 346 358 inlet; +#X obj 323 337 *~; +#X obj 323 283 bp~ 2000 7; +#X obj 136 449 outlet~; +#X obj 110 98 r insamplength; +#X msg 134 247 0 \, \$1 \$2; +#X obj 134 221 pack 0 0; +#X obj 180 199 /; +#X obj 184 147 * 0.001; +#X obj 180 171 t b f; +#X text 312 234 nasty non-flat noise; +#X obj 136 422 hip~ 5; +#X obj 90 7 loadbang; +#X text 242 13 sample playback; +#X msg 90 27 1; +#X obj 89 67 metro 1000; +#X floatatom 89 46; +#X obj 346 314 phasor~ 3000; +#X connect 0 0 5 0; +#X connect 1 0 0 0; +#X connect 2 0 17 0; +#X connect 2 0 18 0; +#X connect 3 0 19 0; +#X connect 4 0 7 1; +#X connect 5 0 7 0; +#X connect 6 0 13 0; +#X connect 7 0 22 0; +#X connect 8 0 5 1; +#X connect 9 0 4 1; +#X connect 10 0 8 0; +#X connect 11 0 9 0; +#X connect 12 0 4 0; +#X connect 13 0 12 0; +#X connect 15 0 2 1; +#X connect 16 0 1 0; +#X connect 17 0 16 0; +#X connect 18 0 17 1; +#X connect 18 0 26 1; +#X connect 19 0 20 0; +#X connect 20 0 18 0; +#X connect 20 1 18 1; +#X connect 22 0 14 0; +#X connect 23 0 25 0; +#X connect 25 0 27 0; +#X connect 26 0 2 0; +#X connect 27 0 26 0; +#X connect 28 0 12 1; +#X restore 106 373 pd test-signal; +#X text 94 315 sampler; +#N canvas 132 255 634 331 insample 0; +#X graph graph1 0 -1 155947 1 180 168 580 18; +#X array sample 155948 float; +#X pop; +#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 647 409 pd insample; +#X text 536 219 read a sample; +#X msg 446 240 \; read-sample ../sound/bell.aiff 44100; +#X connect 0 0 5 0; +#X connect 1 0 3 0; +#X connect 3 0 2 0; +#X connect 3 0 2 1; +#X connect 6 0 3 1; +#X connect 7 0 12 0; +#X connect 8 0 7 0; +#X connect 9 0 8 0; +#X connect 13 0 6 0; +#X connect 14 0 15 0; +#X connect 15 0 20 1; +#X connect 17 0 22 0; +#X connect 18 0 17 0; +#X connect 19 0 20 0; +#X connect 19 0 22 0; +#X connect 20 0 21 0; +#X connect 27 0 28 0; +#X connect 29 0 27 0; +#X connect 33 0 27 0; +#X connect 40 0 44 0; +#X connect 43 0 44 1; +#X connect 44 0 1 0; |