#N canvas 531 59 913 624 12;
#X declare -stdpath ./;
#N canvas 0 0 450 300 (subpatch) 0;
#X array cos-output 44100 float 0;
#X coords 0 1.02 44100 -1.02 200 130 1;
#X restore 549 201 graph;
#N canvas 0 0 450 300 (subpatch) 0;
#X array table18 44103 float 0;
#X coords 0 1.02 44103 -1.02 200 130 1;
#X restore 546 26 graph;
#X obj 548 475 loadbang;
#X obj 121 249 hip~ 5;
#X floatatom 121 50 0 0 0 0 - - - 0;
#X floatatom 204 87 0 0 0 0 - - - 0;
#X obj 204 114 * 441;
#X obj 186 163 +~ 1;
#X obj 551 374 adc~ 1;
#X msg 566 399 bang;
#X text 40 9 ENVELOPING YOUR LOOPING SAMPLER;
#X obj 121 139 -~ 0.5;
#X obj 121 189 cos~;
#X obj 121 222 *~;
#X obj 548 529 soundfiler;
#X text 561 158 -- 44103 samples ---;
#X text 572 334 ----- 1 second ------;
#X obj 121 77 phasor~;
#X obj 121 164 *~ 0.5;
#X obj 121 283 output~;
#X obj 186 138 *~;
#X text 65 360 Here we apply an amplitude envelope to protect against
discontinuities at the loop point. The envelope is just a cosine wave
from -90 degrees to +90 degrees \, (-pi/2 to pi/2 radians) \, i.e.
\, the part that is zero or positive in sign. The "cos~" object's input
is in cycles (units of 2pi radians) so -1/4 to +1/4 addresses the desired
part of the waveform.;
#X obj 243 247 tabwrite~ cos-output;
#X obj 243 223 bng 15 250 50 0 empty empty empty 0 -6 0 8 #fcfcfc #000000
#000000;
#X text 65 468 To see the envelope \, put the phasor on 2 Hz or so
\, click the "graph" button \, and look at "cos-output." This is multiplied
by the tabread4~ output so that it doesn't click when the phase wraps
around., f 59;
#X text 65 535 It is possible to get much more control over the shape
of the envelope \, but this will be taken up later., f 59;
#X obj 186 189 tabread4~ table18;
#X obj 551 426 tabwrite~ table18;
#X msg 548 504 read ../sound/voice.wav table18;
#X text 608 400 <-- click here to record to table;
#X text 639 483 v-- re-read the original sound;
#X text 655 558 updated for Pd version 0.37;
#X text 264 220 <= click to graph envelope;
#X text 243 86 <= chunk size (100ths of a second);
#X text 160 49 <= frequency (Hz.);
#X obj 306 298 declare -stdpath ./;
#X connect 2 0 28 0;
#X connect 3 0 19 0;
#X connect 3 0 19 1;
#X connect 4 0 17 0;
#X connect 5 0 6 0;
#X connect 6 0 20 1;
#X connect 7 0 26 0;
#X connect 8 0 27 0;
#X connect 9 0 27 0;
#X connect 11 0 18 0;
#X connect 12 0 13 0;
#X connect 12 0 22 0;
#X connect 13 0 3 0;
#X connect 17 0 11 0;
#X connect 17 0 20 0;
#X connect 18 0 12 0;
#X connect 20 0 7 0;
#X connect 23 0 22 0;
#X connect 26 0 13 1;
#X connect 28 0 14 0;
