#N canvas 279 81 910 609 10;
#N canvas 0 0 600 392 samples 0;
#N canvas 0 0 450 300 (subpatch) 0;
#X array sample1 176403 float 0;
#X coords 0 1.02 176403 -1.02 200 130 1;
#X restore 262 41 graph;
#X text 282 385 ------ 4 seconds ------;
#N canvas 0 0 450 300 (subpatch) 0;
#X array sample2 176403 float 0;
#X coords 0 1.02 176403 -1.02 200 130 1;
#X restore 262 226 graph;
#X restore 741 100 pd samples;
#N canvas 52 219 967 340 recorder 0;
#X obj 220 21 inlet;
#X obj 174 174 adc~ 1;
#X obj 174 202 hip~ 5;
#X obj 243 232 line~;
#X obj 174 231 *~;
#X msg 243 204 1;
#X obj 302 169 del 3990;
#X msg 279 204 0 10;
#X obj 174 282 tabwrite~ sample1;
#X msg 26 117 set \$1 \, bang;
#X msg 348 140 stop;
#X msg 302 140 bang;
#X obj 220 50 route record stop reload browse;
#X obj 411 158 loadbang;
#X obj 514 113 openpanel;
#X msg 514 85 bang;
#X text 556 84 <-- browse for samples;
#X text 482 209 v-- re-read original samples;
#X obj 411 295 soundfiler;
#X msg 411 237 read ../sound/bell.aiff sample1 \, read ../sound/voice2.wav
sample2;
#X msg 514 140 read \$1 sample1;
#X obj 514 167 soundfiler;
#X obj 26 88 makefilename sample%d;
#X connect 0 0 12 0;
#X connect 1 0 2 0;
#X connect 2 0 4 0;
#X connect 3 0 4 1;
#X connect 4 0 8 0;
#X connect 5 0 3 0;
#X connect 6 0 7 0;
#X connect 7 0 3 0;
#X connect 9 0 8 0;
#X connect 10 0 6 0;
#X connect 11 0 6 0;
#X connect 12 0 11 0;
#X connect 12 0 5 0;
#X connect 12 0 22 0;
#X connect 12 1 7 0;
#X connect 12 1 10 0;
#X connect 12 2 19 0;
#X connect 12 3 15 0;
#X connect 13 0 19 0;
#X connect 14 0 20 0;
#X connect 15 0 14 0;
#X connect 19 0 18 0;
#X connect 20 0 21 0;
#X connect 22 0 9 0;
#X restore 741 287 pd recorder;
#X msg 741 149 record 1;
#X msg 741 205 stop;
#X msg 741 177 record 2;
#X text 19 38 ARGUMENTS FOR NOTES:;
#X text 19 60 pitch in halftones;
#X text 19 84 amplitude (dB);
#X text 19 132 sample number;
#X text 19 108 duration (msec);
#X text 19 156 start location (msec);
#X text 19 180 rise time (msec);
#X text 19 204 decay time (msec);
#X msg 741 232 reload;
#X msg 741 260 browse;
#X obj 497 316 sampvoice;
#X obj 581 20 r note;
#X obj 581 42 unpack 0 0 0 0 0 0 0;
#X obj 554 69 t b f;
#X obj 494 102 f;
#X obj 530 102 + 1;
#X obj 502 139 mod 1e+06;
#X obj 494 168 makenote 64;
#X obj 494 196 poly 8 1;
#X obj 494 223 stripnote;
#X obj 567 265 pack 0 0 0 0 0 0 0 0;
#X obj 567 287 route 1 2 3 4 5 6 7 8;
#X text 739 127 record \, etc.;
#X text 350 196 allocate sampler voice;
#X text 368 223 drop note off again;
#X obj 614 543 qlist;
#X text 612 490 sailors to untie him...;
#X text 612 460 Lashed to the mast of his boat \, Ulysses;
#X text 612 475 hears beautiful singing. He begs his;
#X text 19 229 Here we take the previous patch and make it polyphonic
\, with 8 voices. The single voice which we had before has been made
into an abstraction \, "sampvoice.pd" \, which we instantiate in 8
copies. Earlier we used sends and receives to pass messages to "cutoff"
\, etc \, but here if we did that the copies of sampvoice would be
sending messages to each other \, so we combine the control and the
audio computation in the sampvoice abstraction without using send and
receive. Click on one to see how.;
#X text 19 337 The "poly" object essentially repeats pitch and velocity
pairs to its output \, but also sending a voice number from its left
outlet. To use it \, we unpack the 7 parameters \, calculate the voice
number \, repack the message as 8 parameters with voice number first
\, and use "route" to send it to one of the 8 voices.;
#X text 19 412 There's some bother because poly expects to track note
on and note off messages separately as they would come from a MIDI
keyboard. So we assign each note a unique fake "pitch" \, use makenote
to generate the note-off messages \, and run poly on the resulting
stream. We then discard both pitch and velocity (using the velocity
only to strip note-offs) and rebuild the original message adding the
voice number we just scored.;
#X msg 614 513 read qlist-sampler.txt \, rewind \, tempo 1 \, bang
;
#X obj 498 522 output~;
#X text 286 101 increment mod 1e+06 to make tag;
#X text 321 120 (acts like a MIDI pitch to;
#X text 317 139 identify the note to "poly");
#X text 296 168 supply delayed note-off message;
#X obj 497 493 sampvoice;
#X obj 497 468 sampvoice;
#X obj 497 441 sampvoice;
#X obj 497 416 sampvoice;
#X obj 497 391 sampvoice;
#X obj 497 366 sampvoice;
#X obj 497 341 sampvoice;
#X obj 1 1 cnv 15 445 20 empty \$0-pddp.cnv.header polyphonic_sampler
20 10 1 18 -261139 -33289 0;
#X obj 407 2 pddp/pddplink http://puredata.info/dev/pddp -text pddp
;
#X obj 1 587 cnv 15 445 20 empty \$0-pddp.cnv.footer empty 20 12 0
14 -233017 -33289 0;
#N canvas 44 246 494 284 META 0;
#X text 12 125 WEBSITE http://crca.ucsd.edu/~msp/;
#X text 12 105 AUTHOR Miller Puckette;
#X text 12 85 LIBRARY PDDP;
#X text 12 5 GENRE tutorial;
#X text 12 45 LICENSE SIBSD;
#X text 12 145 HELP_PATCH_AUTHORS Updated for release 0.33. Jonathan
Wilkes revised the patch to conform to the PDDP template for Pd version
0.42.;
#X text 12 25 KEYWORDS signal;
#X text 12 65 DESCRIPTION polyphonic sampler;
#X restore 392 589 pd META;
#N canvas 13 202 428 190 References 0;
#X obj 1 1 cnv 15 425 20 empty \$0-pddp.cnv.subheading empty 3 12 0
14 -261139 -33289 0;
#X text 19 37 links:;
#X text 7 2 polyphonic sampler- Related Help Documents;
#X restore 103 589 pd References;
#X obj 6 589 pddp/pddplink ../5.reference/pddp/help.pd -text help;
#X obj 665 543 r comment;
#X connect 2 0 1 0;
#X connect 3 0 1 0;
#X connect 4 0 1 0;
#X connect 13 0 1 0;
#X connect 14 0 1 0;
#X connect 15 0 49 0;
#X connect 16 0 17 0;
#X connect 17 0 18 0;
#X connect 17 1 25 2;
#X connect 17 2 22 2;
#X connect 17 2 25 3;
#X connect 17 3 25 4;
#X connect 17 4 25 5;
#X connect 17 5 25 6;
#X connect 17 6 25 7;
#X connect 18 0 19 0;
#X connect 18 1 25 1;
#X connect 19 0 20 0;
#X connect 19 0 22 0;
#X connect 20 0 21 0;
#X connect 21 0 19 1;
#X connect 22 0 23 0;
#X connect 22 1 23 1;
#X connect 23 0 24 0;
#X connect 23 2 24 1;
#X connect 24 0 25 0;
#X connect 25 0 26 0;
#X connect 26 0 15 1;
#X connect 26 1 49 1;
#X connect 26 2 48 1;
#X connect 26 3 47 1;
#X connect 26 4 46 1;
#X connect 26 5 45 1;
#X connect 26 6 44 1;
#X connect 26 7 43 1;
#X connect 37 0 30 0;
#X connect 43 0 38 0;
#X connect 43 0 38 1;
#X connect 44 0 43 0;
#X connect 45 0 44 0;
#X connect 46 0 45 0;
#X connect 47 0 46 0;
#X connect 48 0 47 0;
#X connect 49 0 48 0;
