#N canvas 50 103 992 682 12;
#X graph graph1 0 -1.02 44100 1.02 599 426 799 296;
#X array sample-table 44103 float 0;
#X pop;
#X obj 502 568 loadbang;
#X floatatom 88 616 0 0 0;
#N canvas 159 26 495 266 output 0;
#X obj 338 160 t b;
#X obj 338 110 f;
#X obj 338 60 inlet;
#X text 344 29 mute;
#X obj 338 185 f;
#X msg 425 178 0;
#X msg 338 85 bang;
#X obj 338 135 moses 1;
#X obj 425 153 t b f;
#X obj 397 117 moses 1;
#X obj 83 148 dbtorms;
#X obj 397 92 r master-lvl;
#X obj 83 42 r master-lvl;
#X obj 338 210 s master-lvl;
#X obj 22 181 inlet~;
#X obj 199 41 inlet;
#X text 199 18 level;
#X obj 199 100 s master-lvl;
#X msg 96 65 set \$1;
#X obj 96 89 outlet;
#X msg 214 64 \; pd dsp 1;
#X obj 83 194 line~;
#X obj 22 212 *~;
#X obj 22 241 dac~;
#X obj 83 171 pack 0 50;
#X text 20 158 audio;
#X text 93 110 show level;
#X connect 0 0 4 0;
#X connect 1 0 7 0;
#X connect 2 0 6 0;
#X connect 4 0 13 0;
#X connect 5 0 13 0;
#X connect 6 0 1 0;
#X connect 7 0 0 0;
#X connect 7 1 8 0;
#X connect 8 0 5 0;
#X connect 9 1 4 1;
#X connect 10 0 24 0;
#X connect 11 0 1 1;
#X connect 11 0 9 0;
#X connect 12 0 10 0;
#X connect 12 0 18 0;
#X connect 14 0 22 0;
#X connect 15 0 17 0;
#X connect 15 0 20 0;
#X connect 18 0 19 0;
#X connect 21 0 22 1;
#X connect 22 0 23 0;
#X connect 22 0 23 1;
#X connect 24 0 21 0;
#X restore 50 641 pd output;
#X msg 126 614 MUTE;
#X text 168 613 <-- output amplitude;
#X obj 50 586 hip~ 5;
#X obj 50 510 tabread4~ sample-table;
#X floatatom 16 306 0 0 0;
#X obj 16 331 * 441;
#X obj 16 453 +~ 1;
#X obj 35 249 phasor~ 0;
#X text 57 303 <-- chunk size (100ths of a second);
#X obj 497 460 adc~ 1;
#X obj 497 485 hip~ 5;
#X obj 497 534 tabwrite~ sample-table;
#X msg 512 507 bang;
#X text 544 506 <-- click here to record your own sample;
#X text 595 575 v-- re-read the original sample;
#X obj 50 561 *~;
#X text 599 432 -------- 44103 samples ------;
#N canvas 160 476 591 415 envelope 0;
#X obj 81 68 -~ 0.5;
#X obj 83 276 clip~ -0.5 0.5;
#X obj 83 254 *~ 1;
#X obj 127 227 moses 1;
#X msg 96 227 1;
#X obj 83 301 cos~;
#X obj 81 93 wrap~;
#X obj 81 122 -~ 0.5;
#X obj 83 349 *~ -0.5;
#X obj 83 324 -~ 1;
#X floatatom 127 195 0 0 0;
#X text 135 65 subtracting 0.5 and wrapping produces a sawtooth wave
180 degrees out of phase from the original.;
#X text 130 116 as before we subtract 1/2 again to center the sawtooth
from -1/2 to 1/2.;
#X text 177 195 <-- sharpness (at least 1);
#X obj 81 42 inlet~;
#X obj 83 379 outlet~;
#X obj 127 173 inlet;
#X connect 0 0 6 0;
#X connect 1 0 5 0;
#X connect 2 0 1 0;
#X connect 3 0 4 0;
#X connect 3 1 2 1;
#X connect 4 0 2 1;
#X connect 5 0 9 0;
#X connect 6 0 7 0;
#X connect 7 0 2 0;
#X connect 8 0 15 0;
#X connect 9 0 8 0;
#X connect 10 0 3 0;
#X connect 14 0 0 0;
#X connect 16 0 10 0;
#X restore 88 560 pd envelope;
#X floatatom 179 535 0 0 0;
#X text 212 534 <-- envelope sharpness;
#X obj 112 456 line~;
#X obj 112 406 * 441;
#X floatatom 112 381 0 0 0;
#X obj 112 431 pack 0 100;
#X text 158 383 <-- read point in 100ths of a second;
#X obj 50 485 +~;
#X obj 112 481 samphold~;
#X obj 16 381 samphold~;
#X obj 16 356 sig~;
#X obj 16 428 *~;
#X text 18 5 CALCULATING LOOP FREQUENCY AS FUNCTION OF TRANSPOSITION
;
#X obj 88 535 r~ phase;
#X obj 35 274 s~ phase;
#X obj 74 356 r~ phase;
#X obj 32 403 r~ phase;
#X obj 170 457 r~ phase;
#X obj 157 351 s chunk-size;
#X floatatom 22 50 0 0 0;
#X text 66 49 <-- transposition (10ths of a halftone);
#X obj 22 75 / 120;
#X obj 36 149 pow;
#X obj 22 100 t b f;
#X msg 22 125 2;
#X text 86 103 2 to the power (octaves);
#X text 85 125 gives speed change for the;
#X text 85 148 desired transposition;
#X obj 157 326 * 0.01;
#X text 270 339 chunk size;
#X text 270 361 in seconds;
#X obj 46 175 r chunk-size;
#X obj 46 200 t b f;
#X obj 35 224 /;
#X text 105 201 divide speed change by chunk;
#X text 103 222 size to get loop frequency;
#X text 402 74 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 77 75 transposition in octaves;
#X text 404 124 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 text 403 208 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 note-oriented samplers instead.;
#X text 665 650 updated for Pd version 0.33;
#X msg 502 595 read ../sound/voice.wav sample-table;
#X obj 502 622 soundfiler;
#X obj 21 28 loadbang;
#X connect 1 0 63 0;
#X connect 2 0 3 1;
#X connect 3 0 2 0;
#X connect 4 0 3 2;
#X connect 6 0 3 0;
#X connect 7 0 19 0;
#X connect 8 0 9 0;
#X connect 8 0 50 0;
#X connect 9 0 32 0;
#X connect 10 0 29 0;
#X connect 11 0 36 0;
#X connect 13 0 14 0;
#X connect 14 0 15 0;
#X connect 16 0 15 0;
#X connect 19 0 6 0;
#X connect 21 0 19 1;
#X connect 22 0 21 1;
#X connect 24 0 30 0;
#X connect 25 0 27 0;
#X connect 26 0 25 0;
#X connect 27 0 24 0;
#X connect 29 0 7 0;
#X connect 30 0 29 1;
#X connect 31 0 33 0;
#X connect 32 0 31 0;
#X connect 33 0 10 0;
#X connect 35 0 21 0;
#X connect 37 0 31 1;
#X connect 38 0 33 1;
#X connect 39 0 30 1;
#X connect 41 0 43 0;
#X connect 43 0 45 0;
#X connect 44 0 55 0;
#X connect 45 0 46 0;
#X connect 45 1 44 1;
#X connect 46 0 44 0;
#X connect 50 0 40 0;
#X connect 53 0 54 0;
#X connect 54 0 55 0;
#X connect 54 1 55 1;
#X connect 55 0 11 0;
#X connect 63 0 64 0;
#X connect 65 0 41 0;
