#N canvas 426 38 906 742 12;
#X declare -stdpath ./;
#X floatatom 41 141 6 0 1000 0 - \$0-size - 0;
#X obj 173 495 *~;
#X floatatom 263 77 6 -200 200 0 - \$0-precession - 0;
#X obj 47 345 +~;
#X obj 47 290 samphold~;
#X obj 47 317 *~;
#X obj 556 277 s~ phase;
#X obj 191 330 r~ phase;
#X obj 41 196 s chunk-size;
#X floatatom 556 66 6 0 0 0 - \$0-cents - 0;
#X text 135 187 chunk size;
#X text 135 201 in seconds;
#X obj 568 98 r chunk-size;
#X obj 568 123 t b f;
#X obj 191 378 -~ 0.5;
#X obj 191 402 *~ 0.5;
#X obj 191 449 cos~;
#X obj 173 619 output~;
#X obj 556 217 phasor~;
#X obj 365 244 s~ read-pt;
#X obj 82 349 r~ read-pt;
#X obj 627 256 +~ 0.5;
#X obj 627 282 wrap~;
#X obj 627 307 s~ phase2;
#X obj 173 574 +~;
#X obj 41 169 * 0.001;
#X obj 323 193 phasor~;
#X obj 47 260 r chunk-size;
#X obj 47 413 +~ 1;
#X floatatom 556 187 9 0 0 0 - - - 0;
#X obj 263 231 s precession;
#X obj 766 122 t b f;
#X obj 766 97 r precession;
#X obj 263 108 * 0.01;
#X obj 273 495 *~;
#X obj 273 367 +~;
#X obj 273 314 samphold~;
#X obj 273 343 *~;
#X obj 420 383 -~ 0.5;
#X obj 420 407 *~ 0.5;
#X obj 420 452 cos~;
#X obj 307 365 r~ read-pt;
#X obj 273 395 *~ 44100;
#X obj 273 287 r chunk-size;
#X obj 273 421 +~ 1;
#X obj 420 344 r~ phase2;
#X floatatom 351 67 10 0 900 0 - \$0-loop-length - 0;
#X obj 351 92 * 0.001;
#X obj 351 116 t b f;
#X obj 365 220 *~;
#X obj 323 144 /;
#X obj 37 21 cnv 5 5 25 empty empty Time\ Compression/Expansion\ by\ Looped\ Sampling 15 13 0 16 #dfdfdf #202020 0;
#X text 609 66 <-- cents;
#N canvas 1070 307 323 359 init 0;
#X text 57 23 This subpatch initializes the patch and loads values in number boxes., f 29;
#X obj 79 94 loadbang;
#X obj 79 149 f \$0;
#X obj 79 121 bng 19 250 50 0 empty empty empty 0 -10 0 12 #dfdfdf #000000 #000000;
#X obj 79 277 declare -stdpath ./;
#X msg 79 176 \; \$1-cents 0 \; \$1-precession 20 \; \$1-size 250;
#X connect 1 0 3 0;
#X connect 2 0 5 0;
#X connect 3 0 2 0;
#X restore 67 580 pd init;
#X text 539 474 We've delayed multiplying sample location by the sample rate (44100) until the last moment \, so that calculations using "read-pt" and "chunk size" can be in the same units (seconds.), f 46;
#X obj 556 155 expr (pow(2 \, $f1/1200) - $f3) / $f2;
#X text 623 187 (ratio - precession) / size;
#X floatatom 263 176 5 0 0 0 - - - 0;
#X text 538 353 Here \, rather than ask you to push the read pointer back and forth in the sample \, we use a [phasor~]. This makes it possible to avoid the [samphold~] on the read pointer [r~ read-pt] \, since \, knowing the precession \, we can correct for it in computing the frequency of the original [phasor~] above., f 46;
#X text 76 77 precession in percent --> (can be negative), f 25;
#X obj 324 517 loadbang;
#X msg 324 544 ../sound/voice.wav;
#X obj 118 386 r \$0-SR;
#X obj 47 386 *~ 44100;
#X obj 342 395 r \$0-SR;
#X obj 273 445 tabread4~ \$0-sample;
#X obj 47 442 tabread4~ \$0-sample;
#X msg 346 597 ../sound/bell.aiff;
#X msg 335 570 ../sound/voice2.wav;
#X obj 385 630 bng 19 250 50 0 empty empty empty 0 -10 0 12 #dfdfdf #000000 #000000;
#X text 413 630 choose a sample;
#X obj 437 660 bng 19 250 50 0 empty empty empty 0 -10 0 12 #dfdfdf #000000 #000000;
#X text 462 654 record 3 seconds, f 8;
#X text 428 67 <-- loop length (ms), f 11;
#X text 87 141 <-- chunk size (ms);
#X floatatom 323 169 7 0 0 0 - - - 0;
#N canvas 406 326 961 523 smaple-table 1;
#N canvas 0 0 450 300 (subpatch) 0;
#X array \$0-sample 62079 float 2;
#X coords 0 1.02 62079 -1.02 273 194 1 0 0;
#X restore 619 227 graph;
#X obj 453 362 adc~ 1;
#X obj 108 251 soundfiler;
#X obj 415 110 bng 19 250 50 0 empty empty empty 17 7 0 10 #dfdfdf #000000 #000000;
#X text 438 110 <-- record;
#X floatatom 108 310 7 0 0 0 - - - 0;
#X obj 175 280 t f;
#X floatatom 175 310 6 0 0 0 - - - 0;
#X obj 108 359 /;
#X floatatom 108 405 10 0 0 0 - - - 0;
#X obj 175 371 * 0.001;
#X obj 185 339 s \$0-SR;
#X obj 108 439 s \$0-loop-length;
#X text 224 309 <-- file's Sample Rate;
#X text 28 295 sample length -->, f 10;
#X obj 110 66 inlet;
#X obj 163 167 symbol \$0-sample;
#X obj 110 200 pack s s;
#X obj 110 163 t a b;
#X msg 108 224 read -resize \$1 \$2;
#X obj 415 407 tabwrite~ \$0-sample;
#X obj 415 66 inlet;
#X text 185 406 <-- sample length (msec);
#X obj 457 164 samplerate~;
#X obj 457 195 s \$0-SR;
#X obj 452 322 s \$0-sample;
#X obj 452 232 f 3000;
#X msg 452 293 resize \$1;
#X obj 467 264 s \$0-loop-length;
#X obj 216 101 openpanel;
#X obj 216 66 inlet;
#X msg 634 59 0 \, 426375 4834.18;
#X obj 634 83 line~;
#X obj 634 107 tabread4~ \$0-sample;
#X obj 634 131 out~;
#X connect 1 0 20 0;
#X connect 2 0 5 0;
#X connect 2 1 6 0;
#X connect 3 0 20 0;
#X connect 3 0 26 0;
#X connect 3 0 23 0;
#X connect 5 0 8 0;
#X connect 6 0 7 0;
#X connect 7 0 10 0;
#X connect 7 0 11 0;
#X connect 8 0 9 0;
#X connect 9 0 12 0;
#X connect 10 0 8 1;
#X connect 15 0 18 0;
#X connect 16 0 17 1;
#X connect 17 0 19 0;
#X connect 18 0 17 0;
#X connect 18 1 16 0;
#X connect 19 0 2 0;
#X connect 21 0 3 0;
#X connect 23 0 24 0;
#X connect 26 0 27 0;
#X connect 26 0 28 0;
#X connect 27 0 25 0;
#X connect 29 0 18 0;
#X connect 30 0 29 0;
#X connect 31 0 32 0;
#X connect 32 0 33 0;
#X connect 33 0 34 0;
#X restore 335 693 pd smaple-table;
#X text 556 559 The sample now is loaded in the subpatch [pd sample-table]. As for the loaded samples \, we offer more options and also allow you to choose a sample from your hard drive. Also note that now we query the sample rate from the file and used it instead of hard code it., f 41;
#X text 454 694 <------ Open the [pd sample-table] for more details.;
#X connect 0 0 25 0;
#X connect 1 0 24 0;
#X connect 2 0 33 0;
#X connect 3 0 63 0;
#X connect 4 0 5 0;
#X connect 5 0 3 0;
#X connect 7 0 4 1;
#X connect 7 0 5 1;
#X connect 7 0 14 0;
#X connect 9 0 55 0;
#X connect 12 0 13 0;
#X connect 13 0 55 0;
#X connect 13 1 55 1;
#X connect 14 0 15 0;
#X connect 15 0 16 0;
#X connect 16 0 1 1;
#X connect 18 0 21 0;
#X connect 18 0 6 0;
#X connect 20 0 3 1;
#X connect 21 0 22 0;
#X connect 22 0 23 0;
#X connect 24 0 17 0;
#X connect 25 0 8 0;
#X connect 26 0 49 0;
#X connect 27 0 4 0;
#X connect 28 0 66 0;
#X connect 29 0 18 0;
#X connect 31 0 55 0;
#X connect 31 1 55 2;
#X connect 32 0 31 0;
#X connect 33 0 50 0;
#X connect 33 0 57 0;
#X connect 34 0 24 1;
#X connect 35 0 42 0;
#X connect 36 0 37 0;
#X connect 37 0 35 0;
#X connect 38 0 39 0;
#X connect 39 0 40 0;
#X connect 40 0 34 1;
#X connect 41 0 35 1;
#X connect 42 0 44 0;
#X connect 43 0 36 0;
#X connect 44 0 65 0;
#X connect 45 0 38 0;
#X connect 45 0 37 1;
#X connect 45 0 36 1;
#X connect 46 0 47 0;
#X connect 47 0 48 0;
#X connect 48 0 50 0;
#X connect 48 1 50 1;
#X connect 48 1 49 1;
#X connect 49 0 19 0;
#X connect 50 0 75 0;
#X connect 55 0 29 0;
#X connect 57 0 30 0;
#X connect 60 0 61 0;
#X connect 61 0 76 0;
#X connect 62 0 63 1;
#X connect 63 0 28 0;
#X connect 64 0 42 1;
#X connect 65 0 34 0;
#X connect 66 0 1 0;
#X connect 67 0 76 0;
#X connect 68 0 76 0;
#X connect 69 0 76 1;
#X connect 71 0 76 2;
#X connect 75 0 26 0;
