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/03.denoise.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/03.denoise.pd')
-rw-r--r-- | pd/doc/4.fft.examples/03.denoise.pd | 364 |
1 files changed, 364 insertions, 0 deletions
diff --git a/pd/doc/4.fft.examples/03.denoise.pd b/pd/doc/4.fft.examples/03.denoise.pd new file mode 100644 index 00000000..09e1244e --- /dev/null +++ b/pd/doc/4.fft.examples/03.denoise.pd @@ -0,0 +1,364 @@ +#N canvas 54 36 882 556 12; +#X floatatom 306 344; +#X floatatom 68 337; +#N canvas 72 0 896 679 fft-analysis 0; +#X obj 140 447 *~; +#X obj 54 705 *~; +#X obj 139 612 *~; +#X floatatom 206 267; +#X obj 185 349 *~; +#X obj 356 188 + 1; +#X msg 447 257 0; +#X obj 173 181 *~; +#X obj 57 89 *~; +#X obj 95 641 *~; +#X obj 57 49 inlet~; +#X obj 54 642 *~; +#X obj 126 68 tabreceive~ hanning; +#X obj 57 136 rfft~; +#X obj 54 672 rifft~; +#X obj 55 743 outlet~; +#X text 132 50 Hanning window; +#X text 63 115 forward real FFT; +#X text 72 721 inverse real FFT; +#X graph graph1 0 0 1024 20 491 631 891 331; +#X array mask 1024 float; +#X pop; +#X obj 134 180 *~; +#X obj 134 209 +~; +#X msg 447 132 0; +#X obj 317 129 float; +#X obj 377 149 + 1; +#X obj 318 72 bang~; +#X obj 318 101 spigot; +#X obj 449 186 < 10; +#X floatatom 497 185; +#X obj 256 306 tabreceive~ mask; +#X obj 357 267 /; +#X msg 357 237 1; +#X obj 230 350 -~; +#X obj 370 331 sig~; +#X obj 447 232 sel 0; +#X obj 348 356 *~; +#X obj 331 387 +~; +#X obj 330 412 tabsend~ mask; +#X floatatom 448 287; +#X obj 316 156 t f f; +#X obj 446 56 r make-mask; +#X obj 206 296 sig~; +#X obj 206 241 r mask-level; +#X obj 140 414 /~; +#X obj 356 212 t b f; +#X obj 177 612 sig~ 0.001; +#X obj 29 781 block~ 1024 4; +#X obj 663 76 r window-size; +#X obj 447 84 t b f; +#X obj 676 137 t b f; +#X obj 663 171 /; +#X obj 661 194 * 250; +#X text 728 202 hop size in msec; +#X obj 497 107 /; +#X text 497 206 number of; +#X text 505 221 frames; +#X text 439 12 calculate a mask using N msec of; +#X text 438 30 background noise; +#X obj 176 415 sig~ 1e-20; +#X text 152 467 multiply the signal by the; +#X text 153 485 quantity s/(s+m) where "s"; +#X text 152 505 is signal power and "m" is mask.; +#X text 153 527 The multiplier is close to 1 if; +#X text 155 549 s>>m \, but close to 0 if s<<m.; +#X text 157 572 We gratuitously square it.; +#X floatatom 657 237; +#X obj 699 109 r srate; +#X connect 0 0 2 0; +#X connect 1 0 15 0; +#X connect 2 0 11 1; +#X connect 2 0 9 1; +#X connect 3 0 41 0; +#X connect 4 0 43 1; +#X connect 5 0 44 0; +#X connect 6 0 38 0; +#X connect 7 0 21 1; +#X connect 8 0 13 0; +#X connect 9 0 14 1; +#X connect 10 0 8 0; +#X connect 11 0 14 0; +#X connect 12 0 8 1; +#X connect 12 0 1 1; +#X connect 13 0 11 0; +#X connect 13 0 20 0; +#X connect 13 0 20 1; +#X connect 13 1 9 0; +#X connect 13 1 7 0; +#X connect 13 1 7 1; +#X connect 14 0 1 0; +#X connect 20 0 21 0; +#X connect 21 0 32 0; +#X connect 21 0 43 0; +#X connect 21 0 43 1; +#X connect 22 0 23 1; +#X connect 22 0 27 0; +#X connect 23 0 39 0; +#X connect 23 0 24 0; +#X connect 24 0 23 1; +#X connect 25 0 26 0; +#X connect 26 0 23 0; +#X connect 27 0 26 1; +#X connect 27 0 34 0; +#X connect 28 0 27 1; +#X connect 29 0 32 1; +#X connect 29 0 4 0; +#X connect 29 0 36 0; +#X connect 30 0 38 0; +#X connect 31 0 30 0; +#X connect 32 0 35 0; +#X connect 33 0 35 1; +#X connect 34 0 6 0; +#X connect 35 0 36 1; +#X connect 36 0 37 0; +#X connect 38 0 33 0; +#X connect 39 0 27 0; +#X connect 39 1 5 0; +#X connect 40 0 48 0; +#X connect 41 0 4 1; +#X connect 42 0 3 0; +#X connect 43 0 0 0; +#X connect 43 0 0 1; +#X connect 44 0 31 0; +#X connect 44 1 30 1; +#X connect 45 0 2 1; +#X connect 47 0 50 0; +#X connect 48 0 22 0; +#X connect 48 1 53 0; +#X connect 49 0 50 0; +#X connect 49 1 50 1; +#X connect 50 0 51 0; +#X connect 51 0 53 1; +#X connect 51 0 65 0; +#X connect 53 0 28 0; +#X connect 58 0 43 1; +#X connect 66 0 49 0; +#X restore 67 412 pd fft-analysis; +#X obj 67 470 dac~; +#N canvas 99 31 767 592 hanning-window 0; +#X obj 108 242 phasor~; +#X obj 108 275 cos~; +#X obj 27 386 tabwrite~ hanning; +#X obj 35 297 -~; +#X obj 33 257 sig~ 1; +#X msg 44 212 0; +#X text 166 16 CALCULATE HANNING; +#X text 166 32 WINDOW TABLE; +#X graph graph1 0 -1 1024 1 308 538 708 238; +#X array hanning 1024 float; +#X pop; +#X msg 308 550 \; hanning resize 1024; +#X obj 109 154 / 1024; +#X obj 109 201 sig~; +#X text 206 174 sample rate / window size; +#X msg 27 169 bang; +#X obj 78 316 sig~ 0.5; +#X obj 58 353 *~; +#X obj 79 113 samplerate~; +#X obj 29 27 r window-size; +#X obj 29 62 t b f; +#X connect 0 0 1 0; +#X connect 1 0 3 1; +#X connect 3 0 15 0; +#X connect 4 0 3 0; +#X connect 5 0 0 1; +#X connect 10 0 11 0; +#X connect 11 0 0 0; +#X connect 13 0 2 0; +#X connect 13 0 5 0; +#X connect 14 0 15 1; +#X connect 15 0 2 0; +#X connect 16 0 10 0; +#X connect 17 0 18 0; +#X connect 18 0 16 0; +#X connect 18 0 13 0; +#X connect 18 1 10 1; +#X restore 459 435 pd hanning-window; +#X text 157 311 noise; +#X text 91 289 amplitudes; +#X obj 476 467 loadbang; +#N canvas 132 255 634 335 insample 0; +#X graph graph1 0 -1 155947 1 200 170 600 20; +#X array sample 155948 float; +#X pop; +#X obj 21 78 r read-sample; +#X obj 21 106 unpack s f; +#X obj 59 134 s insamprate; +#X obj 21 190 soundfiler; +#X msg 21 163 read -resize \$1 sample; +#X obj 21 223 s insamplength; +#X msg 397 219 \; 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 459 407 pd insample; +#X obj 306 369 s mask-level; +#X obj 119 474 line~; +#X obj 67 442 *~; +#X obj 476 495 samplerate~; +#X obj 476 523 s srate; +#X floatatom 164 338; +#X obj 676 312 hip~ 5; +#X obj 676 284 adc~ 1; +#X msg 749 248 bang; +#X obj 782 284 r srate; +#X obj 749 284 f; +#X obj 749 312 s insamprate; +#X msg 24 209 \; window-size 1024 \; pd dsp 1; +#X obj 676 340 tabwrite~ sample; +#X msg 451 343 \; play-sample 0 5000; +#X floatatom 451 277; +#X floatatom 691 80; +#N canvas 194 37 397 591 output 0; +#X obj 95 230 t b; +#X obj 95 174 f; +#X obj 95 118 inlet; +#X text 101 94 mute; +#X obj 95 258 f; +#X msg 154 284 0; +#X msg 95 146 bang; +#X obj 95 202 moses 1; +#X obj 154 256 t b f; +#X obj 107 490 outlet; +#X msg 107 462 set \$1; +#X obj 228 182 moses 1; +#X obj 249 493 dbtorms; +#X obj 249 521 pack 0 100; +#X obj 228 154 r master-lvl; +#X obj 107 424 r master-lvl; +#X obj 95 315 s master-lvl; +#X obj 249 549 s master-out; +#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 691 52 pd output; +#X msg 691 24 mute; +#X obj 119 446 r master-out; +#X text 734 71 MASTER; +#X text 733 85 LEVEL; +#X obj 691 108 s master-lvl; +#X msg 305 314 6; +#X text 306 291 on; +#X text 351 292 off; +#X text 23 189 click here first; +#X text 301 189 read a sample; +#X text 670 221 record your own sample; +#X text 305 270 masking; +#X text 481 322 play sample back; +#X text 290 5 DENOISER; +#X text 74 22 This patch attempts to scrub the noise floor from a sample in two steps. First using the "make-mask" message (which is caught in the "fft-analysis" window) \, you estimate the background spectrum. Do this while only the background noise is playing.; +#X msg 350 315 0; +#X obj 451 301 metro 2000; +#X msg 201 213 \; read-sample ../sound/bell.aiff 44100; +#N canvas 190 43 534 552 test-signal 0; +#X obj 149 326 tabread4~ sample; +#X obj 149 298 line~; +#X obj 106 162 f; +#X obj 204 137 r insamprate; +#X obj 356 422 *~; +#X obj 151 389 *~; +#X obj 359 290 noise~; +#X obj 151 441 +~; +#X obj 182 390 dbtorms; +#X obj 384 422 dbtorms; +#X obj 182 365 inlet; +#X obj 384 398 inlet; +#X obj 359 375 *~; +#X obj 359 315 bp~ 2000 7; +#X obj 151 499 outlet~; +#X obj 122 109 r insamplength; +#X msg 149 274 0 \, \$1 \$2; +#X obj 149 246 pack 0 0; +#X obj 200 221 /; +#X obj 204 163 * 0.001; +#X obj 200 190 t b f; +#X text 347 260 nasty non-flat noise; +#X obj 151 469 hip~ 5; +#X obj 100 8 loadbang; +#X text 269 15 sample playback; +#X msg 100 30 1; +#X obj 99 74 metro 1000; +#X floatatom 99 51; +#X obj 385 349 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 70 375 pd test-signal; +#X text 56 310 sampler; +#X msg 507 213 \; make-mask 1000; +#X msg 564 492 \; window-size 1024; +#X text 488 186 calculate noise mask; +#X text 74 98 Then turn both the sample and the noise on together \, set the "mask-level" to 6 or so and enjoy the result. Alternatively \, you could try to mask the bell out of the noise...; +#X connect 0 0 9 0; +#X connect 1 0 45 0; +#X connect 2 0 11 0; +#X connect 7 0 12 0; +#X connect 7 0 48 0; +#X connect 10 0 11 1; +#X connect 11 0 3 0; +#X connect 11 0 3 1; +#X connect 12 0 13 0; +#X connect 14 0 45 1; +#X connect 15 0 22 0; +#X connect 16 0 15 0; +#X connect 17 0 19 0; +#X connect 17 0 22 0; +#X connect 18 0 19 1; +#X connect 19 0 20 0; +#X connect 24 0 43 0; +#X connect 25 0 31 0; +#X connect 26 0 25 0; +#X connect 27 0 26 0; +#X connect 28 0 10 0; +#X connect 32 0 0 0; +#X connect 42 0 0 0; +#X connect 43 0 23 0; +#X connect 45 0 2 0; |