#N canvas 338 23 919 681 12;
#N canvas 0 0 450 300 (subpatch) 0;
#X array tab28 176403 float 0;
#X coords 0 1.02 176403 -1.02 200 130 1;
#X restore 594 296 graph;
#X obj 542 479 loadbang;
#X obj 405 210 hip~ 5;
#X obj 583 98 adc~ 1;
#X obj 583 128 hip~ 5;
#X msg 651 58 bang;
#X text 642 485 v-- re-read the original sample;
#X text 78 31 ONE-SHOT SAMPLER USING LINE~ AS PHASE;
#X obj 405 176 *~;
#X obj 445 149 r cutoff;
#X obj 405 59 r phase;
#X msg 49 88 bang;
#X obj 149 143 delay 5;
#X msg 49 179 \; cutoff 0 5;
#X text 58 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.41e+08 samples in 1e+07 milliseconds.;
#X text 58 509 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.;
#X obj 662 178 line~;
#X obj 583 173 *~;
#X text 605 437 ------ 4 seconds ------;
#X obj 722 98 del 3990;
#X msg 722 126 0 10;
#X text 59 579 We avoid clicking at the end of the table by getting
the table's own contents to go smoothly to zero. 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.;
#X obj 542 538 soundfiler;
#X text 58 352 Here's how to make a sampler with a line~ object \,
instead of a phasor~ \, to generate the read location signal., f 59
;
#X obj 445 176 vline~;
#X obj 405 250 output~;
#X obj 405 89 vline~;
#X obj 651 218 tabwrite~ tab28;
#X msg 542 509 read ../sound/bell.aiff tab28;
#X obj 405 119 tabread4~ tab28;
#X msg 149 178 \; phase 1 \, 4.41e+08 1e+07 \; cutoff 1;
#X msg 662 116 0 \, 1 5;
#X text 661 617 updated for Pd version 0.37;
#X text 646 541 My apologies to Jonathan Harvey whose bell this is.
, f 26;
#X text 761 127 <= stop recording, f 9;
#X text 689 57 <= record;
#X text 132 236 set the upper line~ to start at the first sample and
go forever (until the next trigger), f 31;
#X text 102 88 <= play the sample;
#X text 54 140 cut the sound off, f 9;
#X text 208 135 Wait for the cutoff to finish, f 16;
#X connect 1 0 28 0;
#X connect 2 0 25 0;
#X connect 2 0 25 1;
#X connect 3 0 4 0;
#X connect 4 0 17 0;
#X connect 5 0 19 0;
#X connect 5 0 31 0;
#X connect 5 0 27 0;
#X connect 8 0 2 0;
#X connect 9 0 24 0;
#X connect 10 0 26 0;
#X connect 11 0 13 0;
#X connect 11 0 12 0;
#X connect 12 0 30 0;
#X connect 16 0 17 1;
#X connect 17 0 27 0;
#X connect 19 0 20 0;
#X connect 20 0 16 0;
#X connect 24 0 8 1;
#X connect 26 0 29 0;
#X connect 28 0 22 0;
#X connect 29 0 8 0;
#X connect 31 0 16 0;
