#N canvas 380 38 1051 823 12;
#X declare -stdpath ./;
#N canvas 0 0 450 300 (subpatch) 0;
#X array tab28 169735 float 2;
#A color 0;
#A width 2;
#X coords 0 1.02 169735 -1.02 347 161 1;
#X restore 105 612 graph;
#X obj 585 232 adc~ 1;
#X obj 86 192 *~;
#X obj 126 165 r cutoff;
#X obj 86 75 r phase;
#X obj 325 154 delay 5;
#X msg 225 190 \; cutoff 0 5;
#X obj 664 291 line~;
#X obj 585 286 *~;
#X obj 720 211 del 3990;
#X msg 720 239 0 10;
#X obj 86 244 output~;
#X obj 653 331 tabwrite~ tab28;
#X obj 86 135 tabread4~ tab28;
#X msg 664 229 0 \, 1 5;
#X text 230 151 cut the sound off, f 9;
#X text 384 146 Wait for the cutoff to finish, f 16;
#X obj 685 21 declare -stdpath ./;
#X text 249 98 <-- play the sample;
#X obj 225 99 bng 19 250 50 0 empty empty empty 0 -6 0 8 #dfdfdf #000000 #000000;
#X obj 653 171 bng 19 250 50 0 empty empty empty 0 -6 0 8 #dfdfdf #000000 #000000;
#X text 52 352 Here's how to make a sampler with a [line~] object \, instead of a [phasor~] \, to generate the read location signal.;
#X text 52 514 The cutoff mechanism is still safe if we happen to ask for two notes in under 5 msec. The second request would reset the delay \, so that there's no way the delay can possibly fire without the cutoff [line~] at zero., f 59;
#X obj 42 23 cnv 5 5 25 empty empty One-Shot\ Sampler\ using\ [line~]\ as\ Phase 15 13 0 16 #dfdfdf #202020 0;
#X text 292 248 set the upper [line~] to start at the first sample and go "forever" (until the next trigger), f 33;
#X obj 86 105 line~;
#X obj 126 192 line~;
#X obj 653 474 vline~;
#X msg 653 417 0 \, 1 5 0 \, 0 10 3990;
#X obj 594 430 adc~ 1;
#X obj 594 484 *~;
#X obj 594 523 tabwrite~ tab28;
#X text 544 75 For recording \, we have a fade in and fade out mechanism to avoid clicks. To do this we added a level control to the recording patch that cuts off just before the recording reaches the end of the table., f 55;
#X text 677 170 <-- record and stop;
#X obj 806 236 s tab28;
#X text 757 233 fade out, f 4;
#X text 865 233 resize to 4 seconds, f 9;
#X text 736 265 at 3.99 seconds, f 7;
#X text 666 438 record and stop;
#X obj 653 378 bng 19 250 50 0 empty empty empty 0 -6 0 8 #dfdfdf #000000 #000000;
#X text 677 377 <-- record and stop;
#X obj 812 439 s tab28;
#X text 871 436 resize to 4 seconds, f 9;
#X obj 600 767 soundfiler;
#X obj 822 684 openpanel;
#X msg 600 733 read -resize \$1 tab28;
#X obj 600 638 symbol ../sound/bell.aiff;
#X obj 600 609 bng 19 250 50 0 empty empty empty 0 -10 0 12 #dfdfdf #000000 #000000;
#X obj 600 579 loadbang;
#X text 610 661 My apologies to Jonathan Harvey whose bell this is., f 26;
#X obj 822 637 bng 19 250 50 0 empty empty empty 0 -10 0 12 #dfdfdf #000000 #000000;
#X text 846 629 read another sample, f 7;
#X text 630 610 (re) read original sample;
#X text 733 475 Same mechanism with [vline~] \, which can schedule more than one line. Check its help file for more details., f 29;
#X msg 806 206 resize 192000;
#X msg 812 409 resize 192000;
#X msg 325 189 \; phase 1 \, 4.8e+08 1e+07 \; cutoff 1;
#X text 52 393 To start a note \, first we have to mute the output in case there's already something playing---otherwise we'll get a click. The "cutoff" [line~] then takes 5 msec to get to zero. After that amount of delay \, we reset the phase to sample number 1 and set it in motion. We want the [line~] output to increase by 1 each sample of output \, so we ask for it to do 4.8e+08 samples in 1e+07 milliseconds (assuming a sample rate of 48 KHz)., f 59;
#X connect 1 0 8 0;
#X connect 2 0 11 0;
#X connect 3 0 26 0;
#X connect 4 0 25 0;
#X connect 5 0 56 0;
#X connect 7 0 8 1;
#X connect 8 0 12 0;
#X connect 9 0 10 0;
#X connect 10 0 7 0;
#X connect 13 0 2 0;
#X connect 14 0 7 0;
#X connect 19 0 6 0;
#X connect 19 0 5 0;
#X connect 20 0 9 0;
#X connect 20 0 12 0;
#X connect 20 0 14 0;
#X connect 20 0 54 0;
#X connect 25 0 13 0;
#X connect 26 0 2 1;
#X connect 27 0 30 1;
#X connect 28 0 27 0;
#X connect 29 0 30 0;
#X connect 30 0 31 0;
#X connect 39 0 55 0;
#X connect 39 0 28 0;
#X connect 44 0 45 0;
#X connect 45 0 43 0;
#X connect 46 0 45 0;
#X connect 47 0 46 0;
#X connect 48 0 47 0;
#X connect 50 0 44 0;
#X connect 54 0 34 0;
#X connect 55 0 41 0;
