#N canvas 334 52 911 558 12;
#X declare -stdpath ./;
#X floatatom 544 155 7 0 0 1 - \$0-transpo-set \$0-transpo 16;
#X floatatom 544 187 7 0 0 0 - \$0-speed-set \$0-speed 16;
#X text 75 25 PHASE VOCODER;
#X floatatom 546 252 7 1 60 0 - \$0-length-set \$0-length 16;
#N canvas 221 110 948 526 guts 0;
#X obj 749 223 savepanel;
#X obj 118 181 spigot;
#X msg 158 144 0;
#X msg 190 144 1;
#X obj 267 356 +~;
#X obj 749 415 soundfiler;
#X obj 772 332 savepanel;
#N canvas 470 56 686 815 fft-analysis 0;
#X obj 298 512 *~;
#X obj 266 512 *~;
#X obj 266 534 -~;
#X obj 364 513 *~;
#X obj 333 513 *~;
#X obj 333 536 +~;
#X obj 379 338 *~;
#X obj 348 338 *~;
#X obj 319 338 *~;
#X obj 287 338 *~;
#X obj 287 361 +~;
#X obj 256 391 *~;
#X obj 120 708 *~;
#X obj 426 461 rfft~;
#X obj 427 263 rfft~;
#X obj 427 228 *~;
#X obj 473 257 *~;
#X obj 120 677 *~;
#X obj 150 642 rifft~;
#X obj 120 754 outlet~;
#X obj 392 75 line~;
#X obj 454 104 +~;
#X obj 225 391 *~;
#X obj 225 413 +~;
#X obj 225 439 rsqrt~;
#X obj 348 361 -~;
#X obj 268 469 *~;
#X obj 329 469 *~;
#X obj 138 591 /;
#X obj 172 322 sig~ 1.5e-20;
#X obj 465 537 switch~ 2048 4;
#X obj 454 130 tabread4~ \$0-input;
#X obj 392 160 tabread4~ \$0-input;
#X obj 491 194 tabreceive~ \$0-hanning;
#X obj 266 630 tabsend~ \$0-phase-real;
#X obj 333 578 tabsend~ \$0-phase-imag;
#X obj 320 244 tabreceive~ \$0-phase-imag, f 13;
#X obj 216 244 tabreceive~ \$0-phase-real, f 13;
#X obj 465 513 r \$0-running;
#X msg 138 563 1 \$1;
#X obj 138 532 r \$0-window-size;
#N canvas 732 116 607 605 control 0;
#X obj 208 275 f;
#X obj 203 108 t b f;
#X obj 185 140 /;
#X obj 208 246 bang~;
#X obj 185 166 * 1000;
#X text 50 169 window size (msec);
#X obj 248 277 +;
#X obj 257 223 *;
#X obj 240 432 +;
#X obj 208 381 t f f;
#X msg 121 502 \$1 \, \$2 \$3;
#X obj 298 304 / 1000;
#X obj 208 352 *;
#X text 238 352 reading location (samples);
#X obj 279 493 / 4;
#X text 310 494 hop size (samples);
#X text 258 103 (overlap times parent SR);
#X text 258 89 local sample rate;
#X obj 257 168 * 0.01;
#X obj 279 453 *;
#X obj 447 300 * 0.01;
#X obj 447 327 + 69;
#X obj 447 353 mtof;
#X obj 447 382 / 440;
#X obj 291 427 t b f;
#X obj 257 192 t b f;
#X obj 121 474 pack f f f;
#X obj 447 274 r \$0-transpo;
#X obj 257 144 r \$0-speed;
#X obj 295 225 r \$0-location;
#X obj 298 281 r \$0-sample-rate;
#X obj 203 60 r \$0-sample-rate;
#X obj 279 380 r \$0-window-size;
#X obj 185 26 r \$0-window-size;
#X obj 121 536 outlet;
#X obj 279 536 outlet;
#X obj 203 85 * 4;
#N canvas 47 74 450 300 loop 0;
#X obj 190 201 s \$0-see-location;
#X obj 191 90 r \$0-length-ms;
#X obj 152 89 /;
#X obj 152 117 wrap;
#X obj 173 154 *;
#X obj 151 52 inlet;
#X obj 169 234 outlet;
#X connect 1 0 2 1;
#X connect 1 0 4 1;
#X connect 2 0 3 0;
#X connect 3 0 4 0;
#X connect 4 0 0 0;
#X connect 4 0 6 0;
#X connect 5 0 2 0;
#X restore 208 306 pd loop;
#X connect 0 0 37 0;
#X connect 1 0 2 0;
#X connect 1 1 2 1;
#X connect 2 0 4 0;
#X connect 3 0 0 0;
#X connect 4 0 7 0;
#X connect 4 0 26 2;
#X connect 6 0 0 1;
#X connect 7 0 6 1;
#X connect 8 0 26 1;
#X connect 9 0 26 0;
#X connect 9 1 8 0;
#X connect 10 0 34 0;
#X connect 11 0 12 1;
#X connect 12 0 9 0;
#X connect 14 0 35 0;
#X connect 18 0 25 0;
#X connect 19 0 8 1;
#X connect 19 0 14 0;
#X connect 20 0 21 0;
#X connect 21 0 22 0;
#X connect 22 0 23 0;
#X connect 23 0 24 0;
#X connect 24 0 19 0;
#X connect 24 1 19 1;
#X connect 25 0 7 0;
#X connect 25 1 7 1;
#X connect 26 0 10 0;
#X connect 27 0 20 0;
#X connect 28 0 18 0;
#X connect 29 0 0 1;
#X connect 30 0 11 0;
#X connect 31 0 36 0;
#X connect 32 0 19 0;
#X connect 33 0 2 0;
#X connect 36 0 1 0;
#X connect 37 0 12 0;
#X connect 37 0 6 0;
#X restore 392 44 pd control;
#X obj 165 705 tabreceive~ \$0-hanning;
#X connect 0 0 2 1;
#X connect 1 0 2 0;
#X connect 2 0 18 0;
#X connect 2 0 34 0;
#X connect 3 0 5 1;
#X connect 4 0 5 0;
#X connect 5 0 18 1;
#X connect 5 0 35 0;
#X connect 6 0 25 1;
#X connect 7 0 25 0;
#X connect 8 0 10 1;
#X connect 9 0 10 0;
#X connect 10 0 26 1;
#X connect 10 0 22 0;
#X connect 10 0 22 1;
#X connect 11 0 23 1;
#X connect 12 0 19 0;
#X connect 13 0 1 1;
#X connect 13 0 3 1;
#X connect 13 1 0 1;
#X connect 13 1 4 1;
#X connect 14 0 9 1;
#X connect 14 0 7 1;
#X connect 14 1 6 1;
#X connect 14 1 8 1;
#X connect 15 0 14 0;
#X connect 16 0 13 0;
#X connect 17 0 12 0;
#X connect 18 0 17 0;
#X connect 20 0 21 0;
#X connect 20 0 32 0;
#X connect 21 0 31 0;
#X connect 22 0 23 0;
#X connect 23 0 24 0;
#X connect 24 0 26 0;
#X connect 24 0 27 0;
#X connect 25 0 27 1;
#X connect 25 0 11 0;
#X connect 25 0 11 1;
#X connect 26 0 1 0;
#X connect 26 0 4 0;
#X connect 27 0 0 0;
#X connect 27 0 3 0;
#X connect 28 0 17 1;
#X connect 29 0 10 0;
#X connect 31 0 16 0;
#X connect 32 0 15 0;
#X connect 33 0 16 1;
#X connect 33 0 15 1;
#X connect 36 0 7 0;
#X connect 36 0 8 0;
#X connect 37 0 9 0;
#X connect 37 0 6 0;
#X connect 38 0 30 0;
#X connect 39 0 28 0;
#X connect 40 0 39 0;
#X connect 41 0 20 0;
#X connect 41 1 21 1;
#X connect 42 0 12 1;
#X restore 126 302 pd fft-analysis;
#X obj 267 472 outlet~;
#N canvas 536 50 293 373 length 0;
#X msg 85 262 resize \$1;
#X obj 67 63 clip 1 60;
#X obj 99 229 samplerate~;
#X obj 67 193 t f b;
#X obj 67 229 *;
#X obj 99 128 s \$0-length-ms;
#X obj 99 100 * 1000;
#X obj 85 288 s \$0-output;
#X obj 67 323 s \$0-maxoutsize;
#X obj 67 28 r \$0-length;
#X connect 0 0 7 0;
#X connect 1 0 3 0;
#X connect 1 0 6 0;
#X connect 2 0 4 1;
#X connect 3 0 4 0;
#X connect 3 1 2 0;
#X connect 4 0 0 0;
#X connect 4 0 8 0;
#X connect 6 0 5 0;
#X connect 9 0 1 0;
#X restore 496 114 pd length;
#X obj 470 410 r \$0-length-ms;
#X obj 409 406 timer;
#X obj 441 379 metro 100;
#X obj 377 333 t b b;
#X obj 409 302 sel 1;
#X obj 452 440 /;
#X obj 452 472 outlet;
#N canvas 146 172 310 442 see-loc 0;
#X obj 86 372 outlet;
#X obj 72 139 t b f;
#X obj 86 332 f;
#X obj 72 272 del 100, f 3;
#X obj 40 239 t b b;
#X obj 40 202 sel 1;
#X msg 222 149 1;
#X msg 208 118 0;
#X obj 84 174 tgl 15 0 empty empty empty 17 7 0 10 #fcfcfc #000000 #000000 0 1;
#X obj 40 173 int 1;
#X obj 73 58 r \$0-location;
#X obj 87 93 r \$0-see-location;
#X connect 1 0 9 0;
#X connect 1 1 2 1;
#X connect 2 0 0 0;
#X connect 3 0 6 0;
#X connect 3 0 2 0;
#X connect 4 0 7 0;
#X connect 4 1 3 0;
#X connect 5 0 4 0;
#X connect 6 0 8 0;
#X connect 7 0 8 0;
#X connect 8 0 9 1;
#X connect 9 0 5 0;
#X connect 10 0 1 0;
#X connect 11 0 1 0;
#X restore 584 373 pd see-loc;
#X obj 584 472 outlet;
#X obj 602 406 r \$0-length-ms;
#X obj 584 436 /;
#X obj 749 197 r \$0-save;
#X obj 772 306 r \$0-save-normalized;
#X obj 100 99 r \$0-run;
#X obj 190 95 r \$0-start;
#X obj 285 270 r \$0-hear;
#X obj 102 210 b;
#X obj 285 300 tabplay~ \$0-output, f 9;
#X obj 105 360 tabwrite~ \$0-output;
#X obj 749 248 list append \$0-output;
#X obj 772 357 list append \$0-output;
#X obj 713 113 openpanel;
#X obj 713 85 r \$0-read;
#X msg 713 170 read -resize \$1 \$2;
#X obj 713 142 list append \$0-input;
#X obj 409 278 r \$0-running;
#X msg 749 274 write \$1 \$2;
#X msg 772 382 write \$1 \$2;
#N canvas 404 465 524 247 init 0;
#N canvas 566 82 696 526 hanning-window 0;
#X obj 105 281 phasor~;
#X obj 105 309 cos~;
#X msg 63 238 0;
#N canvas 0 0 450 300 (subpatch) 0;
#X array \$0-hanning 2048 float 0;
#X coords 0 1 2047 0 400 150 1 0 0;
#X restore 212 221 graph;
#X obj 105 149 samplerate~;
#X obj 34 72 t b f;
#X obj 105 230 /;
#X obj 34 416 tabwrite~ \$0-hanning;
#X obj 34 31 r \$0-window-size;
#X text 193 19 CALCULATE HANNING WINDOW TABLE, f 17;
#X obj 105 336 *~ -0.5;
#X obj 105 361 +~ 0.5;
#X connect 0 0 1 0;
#X connect 1 0 10 0;
#X connect 2 0 0 1;
#X connect 4 0 6 0;
#X connect 5 0 4 0;
#X connect 5 0 2 0;
#X connect 5 0 7 0;
#X connect 5 1 6 1;
#X connect 6 0 0 0;
#X connect 8 0 5 0;
#X connect 10 0 11 0;
#X connect 11 0 7 0;
#X restore 224 145 pd hanning-window;
#X obj 224 93 table \$0-phase-real 1024;
#X obj 224 118 table \$0-phase-imag 1024;
#X obj 58 35 loadbang;
#X obj 58 59 f \$0;
#X msg 58 95 \; \$1-window-size 2048 \; \$1-length-set 10 \; \$1-transpo-set -300 \; \$1-speed-set 20;
#X connect 3 0 4 0;
#X connect 4 0 5 0;
#X restore 500 62 pd init \; tables;
#N canvas 559 92 586 577 run 0;
#X obj 372 190 samplerate~;
#X obj 90 400 delay;
#X obj 379 341 timer;
#X obj 379 371 * 44.1;
#X obj 411 312 sel 1;
#X obj 379 450 moses;
#X obj 122 369 / 44.1;
#X obj 379 135 f;
#X obj 379 75 r \$0-start-loc;
#X obj 411 253 r \$0-stop;
#X obj 90 428 s \$0-stop;
#X obj 185 367 pack \$0 f;
#X msg 185 395 \; \$1-running 1 \; \$1-output resize \$2 \; pd dsp 1;
#X obj 411 284 v \$0-running;
#X obj 379 501 send \$0-output;
#X msg 379 475 resize \$1;
#X obj 395 423 s \$0-running;
#X msg 395 398 0;
#X obj 185 46 inlet;
#X obj 245 328 r \$0-maxoutsize;
#X obj 430 451 r \$0-maxoutsize;
#X obj 379 161 s \$0-location;
#X obj 372 216 s \$0-sample-rate;
#X obj 379 106 *;
#X obj 412 103 r \$0-length-ms;
#X connect 0 0 22 0;
#X connect 1 0 10 0;
#X connect 2 0 3 0;
#X connect 3 0 5 0;
#X connect 3 0 17 0;
#X connect 4 0 2 1;
#X connect 5 0 15 0;
#X connect 6 0 1 1;
#X connect 7 0 21 0;
#X connect 8 0 23 0;
#X connect 9 0 13 0;
#X connect 11 0 12 0;
#X connect 13 0 4 0;
#X connect 15 0 14 0;
#X connect 17 0 16 0;
#X connect 18 0 2 0;
#X connect 18 0 7 0;
#X connect 18 0 11 0;
#X connect 18 0 0 0;
#X connect 18 0 1 0;
#X connect 19 0 6 0;
#X connect 19 0 11 1;
#X connect 20 0 5 1;
#X connect 23 0 7 0;
#X connect 24 0 23 1;
#X restore 126 243 pd run;
#X obj 25 26 r \$0-transpo;
#X obj 79 72 r \$0-speed;
#X obj 57 49 r \$0-location;
#X connect 0 0 29 0;
#X connect 1 0 2 0;
#X connect 1 0 26 0;
#X connect 2 0 1 1;
#X connect 3 0 1 1;
#X connect 4 0 8 0;
#X connect 6 0 30 0;
#X connect 7 0 4 0;
#X connect 7 0 28 0;
#X connect 10 0 15 1;
#X connect 11 0 15 0;
#X connect 12 0 11 1;
#X connect 13 0 12 0;
#X connect 13 1 11 0;
#X connect 14 0 13 0;
#X connect 14 1 12 0;
#X connect 15 0 16 0;
#X connect 17 0 20 0;
#X connect 19 0 20 1;
#X connect 20 0 18 0;
#X connect 21 0 0 0;
#X connect 22 0 6 0;
#X connect 23 0 2 0;
#X connect 23 0 26 0;
#X connect 24 0 3 0;
#X connect 25 0 27 0;
#X connect 26 0 28 0;
#X connect 26 0 39 0;
#X connect 27 0 4 1;
#X connect 29 0 36 0;
#X connect 30 0 37 0;
#X connect 31 0 34 0;
#X connect 32 0 31 0;
#X connect 33 0 5 0;
#X connect 34 0 33 0;
#X connect 35 0 14 0;
#X connect 36 0 5 0;
#X connect 37 0 5 0;
#X connect 40 0 1 0;
#X connect 41 0 1 0;
#X connect 42 0 1 0;
#X restore 337 381 pd guts;
#X obj 337 472 output~;
#X floatatom 545 219 7 0 1 0 - \$0-start-loc-set \$0-start-loc 16;
#X text 625 157 Transposition in cents;
#X text 625 190 Speed in hundredths;
#X obj 386 442 hsl 128 15 0 1 0 0 empty empty empty -2 -8 0 10 #dfdfdf #000000 #000000 0 1;
#X obj 386 411 hsl 128 15 0 1 0 0 empty empty empty -2 -8 0 10 #dfdfdf #000000 #000000 0 1;
#X text 63 146 click below to:;
#X obj 151 183 bng 18 250 50 0 \$0-read dummy Read -38 9 0 13 #dfdfdf #000000 #202020;
#X obj 151 207 bng 18 250 50 0 \$0-run dummy Run -31 9 0 13 #dfdfdf #000000 #000000;
#X obj 151 232 bng 18 250 50 0 \$0-start dummy Start -46 9 0 13 #dfdfdf #000000 #000000;
#X obj 151 279 bng 18 250 50 0 \$0-hear dummy Hear -40 9 0 13 #dfdfdf #000000 #000000;
#X obj 151 303 bng 18 250 50 0 \$0-save dummy Save -40 9 0 13 #dfdfdf #000000 #000000;
#X obj 151 328 bng 18 250 50 0 \$0-save-normalized dummy Normalized -87 9 0 13 #dfdfdf #000000 #000000;
#X text 180 182 (read an input file);
#X text 180 206 (run the transformation);
#X text 180 278 (hear the output sample);
#X text 180 302 (save the output sample);
#X text 180 327 (save the output sample normalized to 1);
#X text 180 231 (start transformation when I change controls);
#X obj 151 255 bng 18 250 50 0 \$0-stop dummy Stop -40 9 0 13 #dfdfdf #000000 #000000;
#X text 180 254 (stop the transformation);
#X obj 572 301 table \$0-input;
#X obj 566 329 table \$0-output;
#X text 682 302 input sample;
#X text 682 328 output sample;
#X text 522 409 current read location;
#X text 525 441 current buffer recording;
#X obj 690 16 declare -stdpath ./;
#X text 625 222 Set location in sample (0-1);
#X text 48 55 This is a Fourier-based analysis/resynthesis tool. You can perform pitch shift in cents and perform a time stretch or compress with a speed parameter. The sample can move forward (positive speed) \, backwards (negatie speed) or "freeze" at any point (0 speed). The location control sets the start location but also sets the location while running the transformation. The length is a maximum recording length \, you can stop before and it'll resize the buffer so you can export a .wav file., f 113;
#X text 625 255 Set buffer length in seconds (1-60);
#X connect 4 0 5 0;
#X connect 4 1 9 0;
#X connect 4 2 10 0;
