#N canvas 577 81 508 474 12;
#X declare -stdpath ./;
#N canvas 280 40 837 707 fft 0;
#X obj 63 584 *~;
#X obj 288 539 *~;
#X obj 259 538 *~;
#X obj 351 540 *~;
#X obj 319 539 *~;
#X obj 319 567 +~;
#X obj 259 568 -~;
#X obj 457 470 *~;
#X obj 183 260 *~;
#X obj 151 260 *~;
#X obj 151 285 +~;
#X obj 275 149 *~;
#X obj 243 149 *~;
#X obj 507 384 *~;
#X obj 475 384 *~;
#X obj 168 113 *~;
#X obj 63 611 outlet~;
#X obj 63 559 *~;
#X obj 205 112 inlet~;
#X obj 168 190 rfft~;
#X obj 63 535 rifft~;
#X obj 475 412 rsqrt~;
#X obj 243 173 +~;
#X obj 397 470 *~;
#X obj 101 583 sig~ 0.0002;
#N canvas 167 161 699 396 decision 0;
#X obj 49 101 inlet~;
#X obj 50 341 outlet~;
#X obj 50 183 -~;
#X obj 50 226 clip~ 0 1;
#X obj 50 204 *~ 1e+20;
#X obj 196 98 inlet~;
#X text 137 213 stronger than;
#X text 139 228 old one;
#X obj 274 202 -~;
#X obj 288 177 lrshift~ 1;
#X obj 274 250 clip~ 0 1;
#X obj 274 228 *~ 1e+20;
#X obj 450 202 -~;
#X obj 450 250 clip~ 0 1;
#X obj 450 228 *~ 1e+20;
#X obj 464 177 lrshift~ -1;
#X obj 50 283 *~;
#X obj 50 312 *~;
#X text 135 199 1 if new signal;
#X text 55 73 new;
#X text 203 70 old;
#X text 51 12 Choose whether to replace the "old" signal with the "new"
one. The "new" one must be stronger than the old one and also must
be stronger than its two neighboring channels;
#X text 267 283 1 if we're louder than neighbor;
#X connect 0 0 2 0;
#X connect 0 0 9 0;
#X connect 0 0 8 0;
#X connect 0 0 12 0;
#X connect 0 0 15 0;
#X connect 2 0 4 0;
#X connect 3 0 16 0;
#X connect 4 0 3 0;
#X connect 5 0 2 1;
#X connect 8 0 11 0;
#X connect 9 0 8 1;
#X connect 10 0 16 1;
#X connect 11 0 10 0;
#X connect 12 0 14 0;
#X connect 13 0 17 1;
#X connect 14 0 13 0;
#X connect 15 0 12 1;
#X connect 16 0 17 0;
#X connect 17 0 1 0;
#X restore 151 312 pd decision;
#X obj 475 434 *~;
#N canvas 352 333 393 308 divide-by-prev 0;
#X obj 204 88 inlet~;
#X obj 266 90 inlet~;
#X obj 204 240 outlet~;
#X obj 267 240 outlet~;
#X obj 70 240 outlet~;
#X obj 138 240 outlet~;
#X obj 171 169 *~;
#X obj 138 169 *~;
#X obj 103 170 *~;
#X obj 70 170 *~;
#X obj 70 198 +~;
#X obj 138 197 -~;
#X obj 89 34 tabreceive~ \$0-last-real;
#X obj 121 61 tabreceive~ \$0-last-imag;
#X connect 0 0 2 0;
#X connect 0 0 9 0;
#X connect 0 0 6 0;
#X connect 1 0 3 0;
#X connect 1 0 8 0;
#X connect 1 0 7 0;
#X connect 6 0 11 1;
#X connect 7 0 11 0;
#X connect 8 0 10 1;
#X connect 9 0 10 0;
#X connect 10 0 4 0;
#X connect 11 0 5 0;
#X connect 12 0 9 1;
#X connect 12 0 7 1;
#X connect 13 0 8 1;
#X connect 13 0 6 1;
#X restore 500 279 pd divide-by-prev;
#N canvas 650 183 602 327 switch 0;
#X obj 61 160 inlet~;
#X obj 149 96 inlet~;
#X obj 211 97 inlet~;
#X obj 315 94 inlet~;
#X obj 375 94 inlet~;
#X obj 409 182 -~;
#X obj 380 228 +~;
#X obj 414 226 *~;
#X obj 292 179 -~;
#X obj 262 225 +~;
#X obj 296 225 *~;
#X obj 261 275 outlet~;
#X obj 380 271 outlet~;
#X text 88 25 switch between two pairs of inputs. If first inlet is
one \, take the left-hand pair \, otherwise the right-hand one.;
#X text 57 137 switch;
#X text 134 73 pass this if one;
#X text 311 74 pass this if zero;
#X connect 0 0 10 1;
#X connect 0 0 7 1;
#X connect 1 0 8 0;
#X connect 2 0 5 0;
#X connect 3 0 9 0;
#X connect 3 0 8 1;
#X connect 4 0 6 0;
#X connect 4 0 5 1;
#X connect 5 0 7 0;
#X connect 6 0 12 0;
#X connect 7 0 6 1;
#X connect 8 0 10 0;
#X connect 9 0 11 0;
#X connect 10 0 9 1;
#X restore 277 369 pd switch;
#X obj 548 357 r revtime;
#X obj 99 560 tabreceive~ \$0-hann;
#X obj 168 84 tabreceive~ \$0-hann;
#X obj 442 174 tabreceive~ \$0-inc-real;
#X obj 459 226 tabreceive~ \$0-inc-imag;
#X obj 616 304 tabsend~ \$0-last-imag;
#X obj 577 327 tabsend~ \$0-last-real;
#X obj 457 510 tabsend~ \$0-inc-imag;
#X obj 397 536 tabsend~ \$0-inc-real;
#X msg 558 380 set \$1;
#X obj 558 404 s revtime-set;
#X obj 681 141 loadbang;
#X msg 681 167 \; pd dsp 1 \; window-size 4096 \; revtime 20;
#X obj 681 50 r window-size;
#X msg 681 72 set \$1 4;
#X obj 681 94 block~;
#X obj 548 428 expr 1 - 0.2/max(0.2 \, $f1);
#X obj 322 55 tabreceive~ \$0-amp-real;
#X obj 337 107 tabreceive~ \$0-amp-imag;
#X obj 319 621 tabsend~ \$0-amp-imag;
#X obj 259 650 tabsend~ \$0-amp-real;
#X text 314 15 previous output amplitude \, encoding both magnitude
and phase, f 33;
#X text 435 136 previous phase increment (unit-magnitude complex number)
, f 31;
#X obj 442 199 +~ 1e-15;
#X obj 322 81 +~ 1e-15;
#X text 61 635 IFFT and output;
#X text 491 457 normalize increments between 0 and 1 according to revtime.
, f 29;
#X text 352 564 propagate amplitudes by multiplying in the increments
\, which advance the phase and drop magnitude according to revtime.
, f 40;
#X text 31 289 choose whether to punch in new (amplitude \, increment)
pair, f 16;
#N canvas 650 183 602 327 switch 0;
#X obj 61 160 inlet~;
#X obj 149 96 inlet~;
#X obj 211 97 inlet~;
#X obj 315 94 inlet~;
#X obj 375 94 inlet~;
#X obj 409 182 -~;
#X obj 380 228 +~;
#X obj 414 226 *~;
#X obj 292 179 -~;
#X obj 262 225 +~;
#X obj 296 225 *~;
#X obj 261 275 outlet~;
#X obj 380 271 outlet~;
#X text 88 25 switch between two pairs of inputs. If first inlet is
one \, take the left-hand pair \, otherwise the right-hand one.;
#X text 57 137 switch;
#X text 134 73 pass this if one;
#X text 311 74 pass this if zero;
#X connect 0 0 10 1;
#X connect 0 0 7 1;
#X connect 1 0 8 0;
#X connect 2 0 5 0;
#X connect 3 0 9 0;
#X connect 3 0 8 1;
#X connect 4 0 6 0;
#X connect 4 0 5 1;
#X connect 5 0 7 0;
#X connect 6 0 12 0;
#X connect 7 0 6 1;
#X connect 8 0 10 0;
#X connect 9 0 11 0;
#X connect 10 0 9 1;
#X restore 397 353 pd switch;
#X connect 0 0 16 0;
#X connect 1 0 6 1;
#X connect 2 0 6 0;
#X connect 3 0 5 1;
#X connect 4 0 5 0;
#X connect 5 0 48 0;
#X connect 6 0 49 0;
#X connect 7 0 1 0;
#X connect 7 0 3 0;
#X connect 7 0 36 0;
#X connect 8 0 10 1;
#X connect 9 0 10 0;
#X connect 10 0 25 0;
#X connect 11 0 22 1;
#X connect 12 0 22 0;
#X connect 13 0 21 0;
#X connect 14 0 21 0;
#X connect 15 0 19 0;
#X connect 17 0 0 0;
#X connect 18 0 15 1;
#X connect 19 0 9 0;
#X connect 19 0 9 1;
#X connect 19 0 27 0;
#X connect 19 0 28 1;
#X connect 19 1 8 0;
#X connect 19 1 8 1;
#X connect 19 1 27 1;
#X connect 19 1 28 2;
#X connect 20 0 17 0;
#X connect 21 0 26 0;
#X connect 22 0 25 1;
#X connect 23 0 2 0;
#X connect 23 0 4 0;
#X connect 23 0 37 0;
#X connect 24 0 0 1;
#X connect 25 0 28 0;
#X connect 25 0 58 0;
#X connect 26 0 23 1;
#X connect 26 0 7 1;
#X connect 27 0 58 1;
#X connect 27 1 58 2;
#X connect 27 2 35 0;
#X connect 27 3 34 0;
#X connect 28 0 20 0;
#X connect 28 0 3 1;
#X connect 28 0 2 1;
#X connect 28 1 20 1;
#X connect 28 1 1 1;
#X connect 28 1 4 1;
#X connect 29 0 38 0;
#X connect 29 0 45 0;
#X connect 30 0 17 1;
#X connect 31 0 15 0;
#X connect 32 0 52 0;
#X connect 33 0 58 4;
#X connect 38 0 39 0;
#X connect 40 0 41 0;
#X connect 42 0 43 0;
#X connect 43 0 44 0;
#X connect 45 0 26 1;
#X connect 46 0 53 0;
#X connect 47 0 11 0;
#X connect 47 0 11 1;
#X connect 47 0 28 4;
#X connect 52 0 58 3;
#X connect 53 0 12 0;
#X connect 53 0 12 1;
#X connect 53 0 28 3;
#X connect 58 0 14 0;
#X connect 58 0 14 1;
#X connect 58 0 23 0;
#X connect 58 1 13 0;
#X connect 58 1 13 1;
#X connect 58 1 7 0;
#X restore 147 328 pd fft;
#X floatatom 311 266 0 0 1000 0 - revtime-set - 0;
#X floatatom 120 264 0 0 0 0 - - - 0;
#X text 38 11 PIANO REVERB;
#X text 352 269 reverb time;
#X obj 147 363 output~;
#X obj 62 363 output~;
#X text 25 45 This is a phase vocoder acting as a reverberator. The
sound is more coherent (less "whispered") than a real room or a standard
delay-based reverberator., f 60;
#X text 25 99 The technique is to "punch" the incoming sound into channels
where (1) there's a peak \, and (2) the incoming sound drowns out whatever
might already be there. If the sound already in any channel is louder
than the input the input for that channel is ignored.;
#N canvas 464 229 262 333 test-sound 0;
#X obj 46 25 inlet;
#X obj 46 145 osc~;
#X obj 115 201 line~;
#X floatatom 46 86 0 0 0 0 - - - 0;
#X obj 46 59 mtof;
#X obj 46 170 cos~;
#X obj 46 194 hip~ 20;
#X obj 46 117 t f b;
#X obj 115 91 bng 15 250 50 0 empty empty empty 0 -6 0 8 #fcfcfc #000000
#000000;
#X obj 160 172 pack 0 30;
#X obj 160 117 del 20;
#X obj 115 144 pack 1 20;
#X obj 46 236 *~;
#X obj 46 272 outlet~;
#X connect 0 0 4 0;
#X connect 1 0 5 0;
#X connect 2 0 12 1;
#X connect 3 0 7 0;
#X connect 4 0 3 0;
#X connect 5 0 6 0;
#X connect 6 0 12 0;
#X connect 7 0 1 0;
#X connect 7 1 8 0;
#X connect 8 0 10 0;
#X connect 8 0 11 0;
#X connect 9 0 2 0;
#X connect 10 0 9 0;
#X connect 11 0 2 0;
#X connect 12 0 13 0;
#X restore 120 291 pd test-sound;
#X text 108 242 short tone;
#X obj 311 290 s revtime;
#X text 25 180 For each window \, the amplitude in each channel is
propagated by a constant phase increment and multiplied downward by
a gain that determines the "reverb time".;
#N canvas 734 203 602 538 hann-window 0;
#N canvas 0 0 450 300 (subpatch) 0;
#X array \$0-hann 1024 float 0;
#X coords 0 1 1023 0 300 100 1;
#X restore 148 395 graph;
#X obj 365 185 osc~;
#X obj 365 210 *~ -0.5;
#X obj 365 234 +~ 0.5;
#X obj 348 277 tabwrite~ \$0-hann;
#X obj 124 114 r window-size;
#X obj 195 238 /;
#X obj 213 206 samplerate~;
#X obj 195 316 s window-sec;
#X obj 105 252 swap;
#X obj 105 276 /;
#X obj 105 300 s window-hz;
#X obj 206 266 * 1000;
#X obj 206 293 s window-msec;
#X obj 124 149 t f b f;
#X msg 213 156 resize \$1;
#X obj 213 180 s \$0-hann;
#X obj 317 123 r window-hz;
#X msg 390 155 0;
#X obj 317 151 t f b;
#X text 94 21 calculate Hann window table (variable window size) and
constants window-hz (fundamental frequency of analysis) \, window-sec
and window-msec (analysis window size in seconds and msec)., f 56
;
#X connect 1 0 2 0;
#X connect 2 0 3 0;
#X connect 3 0 4 0;
#X connect 5 0 14 0;
#X connect 6 0 8 0;
#X connect 6 0 12 0;
#X connect 7 0 6 1;
#X connect 7 0 9 1;
#X connect 9 0 10 0;
#X connect 9 1 10 1;
#X connect 10 0 11 0;
#X connect 12 0 13 0;
#X connect 14 0 6 0;
#X connect 14 0 9 0;
#X connect 14 1 7 0;
#X connect 14 2 15 0;
#X connect 15 0 16 0;
#X connect 17 0 19 0;
#X connect 18 0 1 1;
#X connect 19 0 1 0;
#X connect 19 1 4 0;
#X connect 19 1 18 0;
#X restore 309 320 pd hann-window;
#N canvas 362 131 651 618 tables 0;
#N canvas 0 0 450 300 (subpatch) 0;
#X array \$0-last-real 2048 float 0;
#X coords 0 500 2048 -500 200 150 1;
#X restore 79 42 graph;
#N canvas 0 0 450 300 (subpatch) 0;
#X array \$0-last-imag 2048 float 0;
#X coords 0 500 2048 -500 200 150 1 0 0;
#X restore 364 44 graph;
#N canvas 0 0 450 300 (subpatch) 0;
#X array \$0-amp-real 2048 float 0;
#X coords 0 500 2048 -500 200 150 1;
#X restore 81 232 graph;
#N canvas 0 0 450 300 (subpatch) 0;
#X array \$0-amp-imag 2048 float 0;
#X coords 0 500 2048 -500 200 150 1;
#X restore 368 232 graph;
#N canvas 0 0 450 300 (subpatch) 0;
#X array \$0-inc-real 2048 float 0;
#X coords 0 1 2048 -1 200 150 1;
#X restore 81 424 graph;
#N canvas 0 0 450 300 (subpatch) 0;
#X array \$0-inc-imag 2048 float 0;
#X coords 0 1 2048 -1 200 150 1;
#X restore 370 424 graph;
#X restore 309 345 pd tables;
#X text 275 389 Updated for Pd version 0.39;
#X text 57 419 reverb in;
#X text 139 420 reverb out;
#X obj 336 14 declare -stdpath ./;
#X connect 0 0 5 0;
#X connect 0 0 5 1;
#X connect 1 0 11 0;
#X connect 2 0 9 0;
#X connect 9 0 0 0;
#X connect 9 0 6 0;
#X connect 9 0 6 1;
