#N canvas 75 15 1014 733 12;
#X graph graph1 0 -1.02 44100 1.02 764 446 964 316;
#X array cos-output 44100 float 0;
#X pop;
#X graph graph1 0 -1.02 44103 1.02 761 148 961 18;
#X array sample-table 44103 float 0;
#X pop;
#X obj 593 579 loadbang;
#X floatatom 96 489 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 67 517 pd output;
#X msg 133 490 MUTE;
#X text 176 490 <-- output amplitude;
#X obj 67 460 hip~ 5;
#X obj 47 408 tabread4~ sample-table;
#X floatatom 46 50 0 0 0;
#X text 85 49 <-- frequency (Hz.);
#X floatatom 97 358 0 0 0;
#X obj 97 385 * 441;
#X obj 47 358 *~ 0;
#X obj 47 383 +~ 1;
#X text 271 274 <-- click to display output;
#X msg 229 275 bang;
#X text 136 357 <-- chunk size (100ths of a second);
#X obj 588 471 adc~ 1;
#X obj 588 495 hip~ 5;
#X obj 588 545 tabwrite~ sample-table;
#X msg 603 518 bang;
#X text 635 518 <-- click here to record your own sample;
#X text 704 583 v-- re-read the original sample;
#X text 40 9 ENVELOPING YOUR LOOPING SAMPLER;
#X obj 88 101 -~ 0.5;
#X obj 88 259 clip~ -0.5 0.5;
#X obj 88 237 *~ 1;
#X graph graph1 0 -1.02 44100 1.02 763 311 963 181;
#X array cos-input 44100 float 0;
#X pop;
#X obj 229 303 tabwrite~ cos-input;
#X obj 88 284 cos~;
#X obj 88 126 wrap~;
#X obj 88 155 -~ 0.5;
#X obj 88 332 *~ -0.5;
#X obj 88 307 -~ 1;
#X obj 229 329 tabwrite~ cos-output;
#X floatatom 119 187 0 0 0;
#X obj 67 433 *~;
#X text 157 98 subtracting 0.5 and wrapping produces a sawtooth wave
180 degrees out of phase from the original.;
#X text 153 150 as before we subtract 1/2 again to center the sawtooth
from -1/2 to 1/2.;
#X text 153 188 <-- sharpness (at least 1);
#X msg 593 608 read ../sound/voice.wav sample-table;
#X obj 593 633 soundfiler;
#X text 776 150 -- 44103 samples ---;
#X text 767 447 ----- 1 second ------;
#X obj 119 211 max 1;
#X obj 46 77 phasor~;
#X text 24 560 Here we apply an amplitude envelope to protect against
discontinuities at the loop point. The envelope is based on the pulse
width modulation example \, except that the widening is applied to
the "1" part of the pulse \, not the "0" part.;
#X text 23 647 To see the envelope \, put the phasor on 2 Hz \, select
"sharpness" values between 1 and 3 \, and look at "cos-input" and "cos-output."
You should both see and hear the effect of the "sharpness" parameter.
;
#X text 734 688 updated for Pd version 0.34;
#X connect 2 0 41 0;
#X connect 3 0 4 1;
#X connect 4 0 3 0;
#X connect 5 0 4 2;
#X connect 7 0 4 0;
#X connect 8 0 37 0;
#X connect 9 0 46 0;
#X connect 11 0 12 0;
#X connect 12 0 13 1;
#X connect 13 0 14 0;
#X connect 14 0 8 0;
#X connect 16 0 29 0;
#X connect 16 0 35 0;
#X connect 18 0 19 0;
#X connect 19 0 20 0;
#X connect 21 0 20 0;
#X connect 25 0 31 0;
#X connect 26 0 30 0;
#X connect 26 0 29 0;
#X connect 27 0 26 0;
#X connect 30 0 34 0;
#X connect 31 0 32 0;
#X connect 32 0 27 0;
#X connect 33 0 35 0;
#X connect 33 0 37 1;
#X connect 34 0 33 0;
#X connect 36 0 45 0;
#X connect 37 0 7 0;
#X connect 41 0 42 0;
#X connect 45 0 27 1;
#X connect 46 0 13 0;
#X connect 46 0 25 0;
