#N canvas 375 23 836 666 12;
#X declare -stdpath ./;
#N canvas 0 0 450 300 (subpatch) 0;
#X array table21 44103 float 2;
#X coords 0 1.02 44103 -1.02 200 130 1;
#X restore 559 296 graph;
#X obj 366 533 loadbang;
#X floatatom 47 262 6 0 0 0 - - - 0;
#X obj 47 297 * 441;
#X obj 47 427 +~ 1;
#X obj 364 408 adc~ 1;
#X obj 364 433 hip~ 5;
#X obj 81 515 *~;
#X obj 143 427 line~;
#X obj 143 377 * 441;
#X floatatom 143 352 0 0 0 0 - - - 0;
#X obj 143 402 pack 0 100;
#X obj 81 456 +~;
#X obj 143 452 samphold~;
#X obj 47 352 samphold~;
#X obj 47 322 sig~;
#X obj 47 402 *~;
#X text 28 5 CALCULATING LOOP FREQUENCY AS FUNCTION OF TRANSPOSITION;
#X obj 228 475 r~ phase;
#X obj 29 216 s~ phase;
#X obj 107 323 r~ phase;
#X obj 65 379 r~ phase;
#X obj 203 428 r~ phase;
#X obj 188 322 s chunk-size;
#X floatatom 29 62 5 0 0 0 - - - 0;
#X obj 188 297 * 0.01;
#X text 284 302 chunk size;
#X text 284 324 in seconds;
#X obj 40 117 r chunk-size;
#X obj 40 142 t b f;
#X obj 29 166 /;
#X text 89 143 divide speed change by chunk;
#X text 87 164 size to get loop frequency;
#X text 371 56 The transposition is frequency in Hz. divided by chunk size in seconds. This patch calculates the loop frequency as a function of desired transposition;
#X text 373 107 Notice now that we get Doppler effects when the chunk size changes. You can suppress that if you don't want it \, by converting the chunk size to an audio signal \, sampling and holding it. But then there would be more work to deal with very low frequencies never triggering the sample and hold...;
#X obj 366 587 soundfiler;
#X obj 29 39 loadbang;
#X obj 228 499 -~ 0.5;
#X obj 228 523 *~ 0.5;
#X obj 228 546 cos~;
#X obj 81 576 output~;
#X obj 81 481 tabread4~ table21;
#X text 459 540 v-- re-read original table;
#X text 615 604 updated for Pd version 0.37;
#X text 592 430 --- 44103 samples ---;
#X obj 29 87 expr pow(2 \, $f1/120);
#X text 218 87 speed change;
#X text 376 189 You might also want to have a way to retrigger the loop to sync it with some other process. By the time we had all this built the patch would be fairly involved. For now \, we'll move on to the next topic...;
#X obj 29 190 phasor~;
#X obj 364 488 tabwrite~ table21;
#X msg 366 560 read ../sound/voice.wav table21;
#X text 101 261 <= chunk size (100ths of a second);
#X text 180 352 <= read point in 100ths of a second;
#X text 71 62 <= transposition (10ths of a halftone);
#X text 403 460 <= record;
#X obj 635 17 declare -stdpath ./;
#X obj 379 461 bng 19 250 50 0 empty empty empty 17 7 0 10 #dfdfdf #000000 #000000;
#X obj 81 543 hip~ 5;
#X connect 1 0 50 0;
#X connect 2 0 3 0;
#X connect 2 0 25 0;
#X connect 3 0 15 0;
#X connect 4 0 12 0;
#X connect 5 0 6 0;
#X connect 6 0 49 0;
#X connect 7 0 57 0;
#X connect 8 0 13 0;
#X connect 9 0 11 0;
#X connect 10 0 9 0;
#X connect 11 0 8 0;
#X connect 12 0 41 0;
#X connect 13 0 12 1;
#X connect 14 0 16 0;
#X connect 15 0 14 0;
#X connect 16 0 4 0;
#X connect 18 0 37 0;
#X connect 20 0 14 1;
#X connect 21 0 16 1;
#X connect 22 0 13 1;
#X connect 24 0 45 0;
#X connect 25 0 23 0;
#X connect 28 0 29 0;
#X connect 29 0 30 0;
#X connect 29 1 30 1;
#X connect 30 0 48 0;
#X connect 36 0 24 0;
#X connect 37 0 38 0;
#X connect 38 0 39 0;
#X connect 39 0 7 1;
#X connect 41 0 7 0;
#X connect 45 0 30 0;
#X connect 48 0 19 0;
#X connect 50 0 35 0;
#X connect 56 0 49 0;
#X connect 57 0 40 0;
