#N canvas 75 15 973 599 12; #N canvas 0 0 450 300 graph1 0; #X array cos-output 44100 float 0; #X coords 0 1.02 44100 -1.02 200 130 1; #X restore 724 191 graph; #N canvas 0 0 450 300 graph1 0; #X array table18 44103 float 0; #X coords 0 1.02 44103 -1.02 200 130 1; #X restore 721 16 graph; #X obj 584 491 loadbang; #X obj 45 249 hip~ 5; #X floatatom 46 50 0 0 0 0 - - -; #X text 85 49 <-- frequency (Hz.); #X floatatom 132 87 0 0 0 0 - - -; #X obj 132 114 * 441; #X obj 110 163 +~ 1; #X text 171 86 <-- chunk size (100ths of a second); #X obj 584 404 adc~ 1; #X msg 599 429 bang; #X text 40 9 ENVELOPING YOUR LOOPING SAMPLER; #X obj 45 139 -~ 0.5; #X obj 45 189 cos~; #X obj 45 222 *~; #X obj 584 545 soundfiler; #X text 736 148 -- 44103 samples ---; #X text 727 322 ----- 1 second ------; #X obj 46 77 phasor~; #X obj 45 164 *~ 0.5; #X obj 44 281 output~; #X obj 110 138 *~; #X text 28 362 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 167 247 tabwrite~ cos-output; #X obj 167 223 bng 15 250 50 0 empty empty empty 0 -6 0 8 -262144 -1 -1; #X text 188 220 <-- click to graph envelope; #X text 28 476 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.; #X text 26 545 It is possible to get much more control over the shape of the envelope \, but this will be taken up later.; #X obj 110 189 tabread4~ table18; #X obj 584 456 tabwrite~ table18; #X msg 584 520 read ../sound/voice.wav table18; #X text 641 430 <-- click here to record to table; #X text 675 499 v-- re-read the original sound; #X text 708 565 updated for Pd version 0.37; #X connect 2 0 31 0; #X connect 3 0 21 0; #X connect 3 0 21 1; #X connect 4 0 19 0; #X connect 6 0 7 0; #X connect 7 0 22 1; #X connect 8 0 29 0; #X connect 10 0 30 0; #X connect 11 0 30 0; #X connect 13 0 20 0; #X connect 14 0 15 0; #X connect 14 0 24 0; #X connect 15 0 3 0; #X connect 19 0 13 0; #X connect 19 0 22 0; #X connect 20 0 14 0; #X connect 22 0 8 0; #X connect 25 0 24 0; #X connect 29 0 15 1; #X connect 31 0 16 0;