#N canvas 293 77 868 620 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 575 533 pd samples;
#N canvas 52 219 971 512 recorder 0;
#X obj 174 304 adc~ 1;
#X obj 174 332 hip~ 5;
#X obj 243 362 line~;
#X obj 174 361 *~;
#X msg 243 334 1;
#X obj 302 299 del 3990;
#X msg 279 334 0 10;
#X obj 174 412 tabwrite~ sample1;
#X msg 26 247 set \$1 \, bang;
#X msg 348 270 stop;
#X msg 302 270 bang;
#X obj 220 180 route record stop reload browse;
#X obj 411 288 loadbang;
#X obj 514 243 openpanel;
#X msg 514 215 bang;
#X text 556 214 <-- browse for samples;
#X text 482 339 v-- re-read original samples;
#X obj 411 425 soundfiler;
#X msg 411 367 read ../sound/bell.aiff sample1 \, read ../sound/voice2.wav
sample2;
#X msg 514 270 read \$1 sample1;
#X obj 514 297 soundfiler;
#X msg 220 41 record 1;
#X msg 220 97 stop;
#X msg 220 69 record 2;
#X msg 220 124 reload;
#X msg 220 152 browse;
#X text 218 19 record \, etc.;
#X obj 26 218 makefilename sample%d;
#X connect 0 0 1 0;
#X connect 1 0 3 0;
#X connect 2 0 3 1;
#X connect 3 0 7 0;
#X connect 4 0 2 0;
#X connect 5 0 6 0;
#X connect 6 0 2 0;
#X connect 8 0 7 0;
#X connect 9 0 5 0;
#X connect 10 0 5 0;
#X connect 11 0 10 0;
#X connect 11 0 4 0;
#X connect 11 0 27 0;
#X connect 11 1 6 0;
#X connect 11 1 9 0;
#X connect 11 2 18 0;
#X connect 11 3 14 0;
#X connect 12 0 18 0;
#X connect 13 0 19 0;
#X connect 14 0 13 0;
#X connect 18 0 17 0;
#X connect 19 0 20 0;
#X connect 21 0 11 0;
#X connect 22 0 11 0;
#X connect 23 0 11 0;
#X connect 24 0 11 0;
#X connect 25 0 11 0;
#X connect 27 0 8 0;
#X restore 575 556 pd recorder;
#X text 572 428 sample number;
#X obj 459 76 unpack 0 0 0 0 0 0 0;
#X obj 403 104 poly 8 1;
#X obj 494 250 route 1 2 3 4 5 6 7 8;
#X obj 398 467 output~;
#X obj 403 129 swap;
#X obj 403 176 route 0;
#X obj 403 153 pack;
#X obj 445 201 unpack;
#X obj 397 269 sampvoice2;
#X obj 403 201 pack;
#X text 723 381 amplitude;
#X text 722 405 pitch;
#X text 641 314 ARGUMENTS FOR:;
#X text 574 356 pitch;
#X text 574 380 amplitude;
#X text 574 404 duration;
#X obj 459 51 r onoff;
#X text 722 338 ON/OFF TRANSITIONS:;
#X text 575 337 ENTIRE NOTES:;
#X text 722 360 tag;
#X text 572 455 sample onset;
#X text 572 481 rise time;
#X text 573 505 decay time;
#X text 719 430 (same other 4);
#X obj 636 159 f;
#X obj 672 159 + 1;
#X obj 636 185 mod 1e+06;
#X obj 494 225 pack 0 0 0 0 0 0 0;
#X obj 718 74 r note;
#X obj 718 100 unpack 0 0 0 0 0 0 0;
#X obj 695 127 t b f;
#X obj 736 237 pack 0 0 0 0 0 0 0;
#X obj 689 285 s onoff;
#X obj 670 230 pipe;
#X obj 670 253 pack;
#X msg 23 448 \; onoff 1 90 60 1 0 0 100;
#X msg 183 448 \; onoff 1 0;
#X msg 24 490 \; onoff 2 90 48 1 0 0 100;
#X msg 183 490 \; onoff 2 0;
#X msg 24 547 \; note 51 90 1000 1 0 0 100;
#X obj 397 292 sampvoice2;
#X obj 397 316 sampvoice2;
#X obj 397 340 sampvoice2;
#X obj 397 363 sampvoice2;
#X obj 397 387 sampvoice2;
#X obj 397 410 sampvoice2;
#X obj 397 434 sampvoice2;
#X text 19 47 Here is a variation on the polyphonic sampler \, which
can take separate messages to start and stop notes (so that you can
attach it to a MIDI keyboard \, for example.) "Note" messages act as
before \, but in an intermediate step they are split onto note-on and
note-off messages \, sent to "onoff". You can alternatively send messages
straight to onoff if you don't know the duration in advance.;
#X text 19 133 Messages to "onoff" require a tag \, which is a number
shared between the note-on and note-off message so that we can track
down the voice to turn it off. If you're using MIDI input \, you can
just re-use the pitch as a tag.;
#X text 22 428 separate messages for not on and off:;
#X text 21 528 single messages to do both as before:;
#X text 19 186 Messages to "onoff" whose amplitude is zero are note-off
messages (the other parameters of note-off messages are ignored). The
"sampvoice2" abstraction is a modification of "sampvoice" which looks
at the amplitude field to decide whether to begin or end a note.;
#X text 20 250 To convert "note" messages to pairs of "onoff" messages
\, first a counter generates a tag. The the "pipe" object delays a
copy of the tag \, which the following "pack" object converts into
a note-off message (a pair of numbers \, the tag and a zero.);
#X text 20 314 Under "r onoff" \, the poly object allocates a voice
number \, putting it out paired with velocity. After swapping the two
and packing them into a single message \, the amplitude is checked
against zero by the "route 0" object \; if zero \, the "pack" confects
a 2-argument message (voice number and zero). Otherwise \, the "unpack"
retrieves the nonzero amplitude for a note-on message \, to which we
add all the other parameters and route to the appropriate voice.;
#X obj 1 1 cnv 15 445 20 empty \$0-pddp.cnv.header poly_sampler...
20 10 1 18 -261139 -33289 0;
#X obj 407 2 pddp/pddplink http://puredata.info/dev/pddp -text pddp
;
#X text 74 27 ... version 2 for separate note-on/off messages;
#X obj 1 598 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.37. 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 600 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 7 2 polyphonic sampler- Related Help Documents;
#X text 19 37 links:;
#X restore 103 600 pd References;
#X obj 6 600 pddp/pddplink ../5.reference/pddp/help.pd -text help;
#X connect 3 0 4 0;
#X connect 3 1 30 1;
#X connect 3 1 4 1;
#X connect 3 2 30 2;
#X connect 3 3 30 3;
#X connect 3 4 30 4;
#X connect 3 5 30 5;
#X connect 3 6 30 6;
#X connect 4 0 7 0;
#X connect 4 2 7 1;
#X connect 5 0 11 1;
#X connect 5 1 43 1;
#X connect 5 2 44 1;
#X connect 5 3 45 1;
#X connect 5 4 46 1;
#X connect 5 5 47 1;
#X connect 5 6 48 1;
#X connect 5 7 49 1;
#X connect 7 0 9 0;
#X connect 7 1 9 1;
#X connect 8 0 12 0;
#X connect 8 1 10 0;
#X connect 9 0 8 0;
#X connect 10 1 30 0;
#X connect 11 0 43 0;
#X connect 12 0 5 0;
#X connect 19 0 3 0;
#X connect 27 0 28 0;
#X connect 28 0 29 0;
#X connect 29 0 27 1;
#X connect 29 0 36 0;
#X connect 29 0 34 0;
#X connect 30 0 5 0;
#X connect 31 0 32 0;
#X connect 32 0 33 0;
#X connect 32 1 34 1;
#X connect 32 2 36 1;
#X connect 32 3 34 3;
#X connect 32 4 34 4;
#X connect 32 5 34 5;
#X connect 32 6 34 6;
#X connect 33 0 27 0;
#X connect 33 1 34 2;
#X connect 34 0 35 0;
#X connect 36 0 37 0;
#X connect 37 0 35 0;
#X connect 43 0 44 0;
#X connect 44 0 45 0;
#X connect 45 0 46 0;
#X connect 46 0 47 0;
#X connect 47 0 48 0;
#X connect 48 0 49 0;
#X connect 49 0 6 0;
#X connect 49 0 6 1;
