#N canvas 449 38 792 716 12;
#X declare -stdpath ./;
#X floatatom 117 82 6 0 0 0 - transpose - 0;
#X obj 117 469 *~;
#X obj 240 395 line~;
#X floatatom 240 150 6 0 0 0 - window - 0;
#X floatatom 117 153 6 0 0 0 - - - 0;
#X obj 117 270 /;
#X obj 165 207 * 0.001;
#X obj 303 459 line~;
#X floatatom 303 383 8 0 0 0 - delay - 0;
#X obj 117 506 +~;
#X obj 61 521 cos~;
#X obj 61 548 *~;
#X obj 181 592 +~;
#X obj 181 395 wrap~;
#X obj 257 454 *~;
#X obj 257 514 +~;
#X obj 199 531 cos~;
#X obj 199 558 *~;
#X obj 165 233 t b f;
#X floatatom 117 296 6 0 0 0 - - - 0;
#X obj 181 368 +~ 0.5;
#X obj 61 469 -~ 0.5;
#X obj 61 495 *~ 0.5;
#X obj 199 454 -~ 0.5;
#X obj 199 503 *~ 0.5;
#X obj 117 207 - 1;
#X obj 117 233 * -1;
#X text 45 287 tape head;
#X obj 181 620 output~;
#X obj 117 327 phasor~;
#X obj 303 410 max 1.5;
#X obj 240 177 max 1;
#X text 45 300 rotation freq, f 9;
#X obj 482 274 delwrite~ G09-del 5000;
#X obj 257 543 delread4~ G09-del, f 9;
#X obj 117 532 delread4~ G09-del, f 9;
#X msg 240 368 \$1 200;
#X msg 303 434 \$1 200;
#X text 403 328 This is a classic rotating-tape-head style pitch shifter using the [delread4~] variable delay object. There are two moving tape heads \, each of which is loudest at the middle of its trajectory \, and enveloped out at the moment it has to jump back (or forward) to start another scratch. Most of the brain work is in computing how fast the tape heads have to move to get the desired transposition., f 49;
#X text 403 571 The [cos~] objects compute the fadein and fadeout of the two delay line outputs. They each traverse the positive half of the cosine waveform (phase -0.25 to +0.25) over the time the phase goes from one end to the other., f 49;
#X text 403 470 The "window size" is the total trajectory of the read points in the delay line \, in milliseconds. The delay times are controlled by a [phasor~] object. The second delay time \, 180 degrees out of phase from the first one \, is computed using the [wrap~] object., f 49;
#X obj 60 30 cnv 5 5 25 empty empty Pitch\ Shifter 15 13 0 16 #dfdfdf #202020 0;
#X text 300 358 delay (ms);
#X obj 117 111 expr pow(2 \, $f1/1200);
#X text 167 83 <-- transposition in cents;
#X text 163 145 speed change, f 6;
#N canvas 844 204 307 299 init 0;
#X obj 84 104 loadbang;
#X obj 72 225 declare -stdpath ./;
#X msg 84 130 \; transpose 0 \; window 100 \; delay 10;
#X text 41 21 This subpatch initialiazes the patch and loads values into number boxes., f 26;
#X connect 0 0 2 0;
#X restore 62 630 pd init;
#X text 364 220 sample loop for test signal -->, f 15;
#X obj 482 197 bng 19 250 50 0 empty empty empty 0 -10 0 12 #dfdfdf #000000 #000000;
#X text 506 195 choose another sample;
#X text 291 150 <-- window (ms);
#N canvas 555 154 649 577 test-loop 0;
#X obj 121 511 outlet~;
#N canvas 0 0 450 300 (subpatch) 0;
#X array \$0-sample 155944 float 2;
#X coords 0 1 155944 -1 279 142 1 0 0;
#X restore 308 268 graph;
#X obj 121 433 *~;
#X obj 163 394 phasor~;
#X obj 121 246 soundfiler;
#X obj 121 66 loadbang;
#X obj 121 94 bng 19 250 50 0 empty empty empty 0 -6 0 8 #dfdfdf #000000 #000000;
#X msg 188 276 \$1;
#X obj 163 307 swap;
#X obj 163 335 /;
#X floatatom 163 365 10 0 0 0 - - - 0;
#X obj 175 160 symbol \$0-sample;
#X obj 121 469 tabread4~ \$0-sample;
#X obj 42 115 openpanel;
#X msg 121 215 read -resize \$1 \$2;
#X obj 121 188 pack s s;
#X obj 121 160 t a b;
#X floatatom 156 433 9 0 0 0 - - - 0;
#X floatatom 203 308 6 0 0 0 - - - 0;
#X text 204 327 sample rate, f 6;
#X text 223 434 length;
#X obj 42 75 bng 19 250 50 0 empty empty empty 0 -6 0 8 #dfdfdf #000000 #000000;
#X obj 42 41 inlet;
#X msg 121 124 ../sound/bell.aiff;
#X text 362 144 load file into array and play loop., f 22;
#X connect 2 0 12 0;
#X connect 3 0 2 0;
#X connect 4 0 8 0;
#X connect 4 0 17 0;
#X connect 4 1 7 0;
#X connect 5 0 6 0;
#X connect 6 0 23 0;
#X connect 7 0 8 1;
#X connect 7 0 18 0;
#X connect 8 0 9 0;
#X connect 8 1 9 1;
#X connect 9 0 10 0;
#X connect 10 0 3 0;
#X connect 11 0 15 1;
#X connect 12 0 0 0;
#X connect 13 0 16 0;
#X connect 14 0 4 0;
#X connect 15 0 14 0;
#X connect 16 0 15 0;
#X connect 16 1 11 0;
#X connect 17 0 2 1;
#X connect 21 0 13 0;
#X connect 22 0 21 0;
#X connect 23 0 16 0;
#X restore 482 235 pd test-loop;
#X connect 0 0 43 0;
#X connect 1 0 9 0;
#X connect 2 0 1 1;
#X connect 2 0 14 1;
#X connect 3 0 31 0;
#X connect 4 0 25 0;
#X connect 5 0 19 0;
#X connect 6 0 18 0;
#X connect 7 0 9 1;
#X connect 7 0 15 1;
#X connect 8 0 30 0;
#X connect 9 0 35 0;
#X connect 10 0 11 0;
#X connect 11 0 12 0;
#X connect 12 0 28 0;
#X connect 13 0 14 0;
#X connect 13 0 23 0;
#X connect 14 0 15 0;
#X connect 15 0 34 0;
#X connect 16 0 17 0;
#X connect 17 0 12 1;
#X connect 18 0 5 0;
#X connect 18 1 5 1;
#X connect 19 0 29 0;
#X connect 20 0 13 0;
#X connect 21 0 22 0;
#X connect 22 0 10 0;
#X connect 23 0 24 0;
#X connect 24 0 16 0;
#X connect 25 0 26 0;
#X connect 26 0 5 0;
#X connect 29 0 1 0;
#X connect 29 0 21 0;
#X connect 29 0 20 0;
#X connect 30 0 37 0;
#X connect 31 0 6 0;
#X connect 31 0 36 0;
#X connect 34 0 17 1;
#X connect 35 0 11 1;
#X connect 36 0 2 0;
#X connect 37 0 7 0;
#X connect 43 0 4 0;
#X connect 48 0 51 0;
#X connect 51 0 33 0;
