#N canvas 303 74 840 630 10;
#X msg 207 32 bang;
#X obj 207 60 delay 5;
#X text 447 294 end of note;
#X obj 313 60 r note;
#N canvas 459 46 678 451 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 264 376 ------ 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 18 292 pd samples;
#N canvas 21 287 947 410 recorder 0;
#X obj 318 43 inlet;
#X obj 272 196 adc~ 1;
#X obj 272 224 hip~ 5;
#X obj 341 254 line~;
#X obj 272 253 *~;
#X msg 341 226 1;
#X obj 400 191 del 3990;
#X msg 377 226 0 10;
#X obj 272 304 tabwrite~ sample1;
#X obj 124 110 makefilename sample%1;
#X msg 124 139 set \$1 \, bang;
#X msg 446 162 stop;
#X msg 400 162 bang;
#X obj 557 182 loadbang;
#X obj 660 137 openpanel;
#X msg 660 109 bang;
#X text 702 108 <-- browse for samples;
#X text 628 233 v-- re-read original samples;
#X obj 318 72 route record stop reload browse;
#X obj 557 319 soundfiler;
#X msg 557 261 read ../sound/bell.aiff sample1 \, read ../sound/voice2.wav
sample2;
#X msg 660 164 read \$1 sample1;
#X obj 660 191 soundfiler;
#X connect 0 0 18 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 10 0;
#X connect 10 0 8 0;
#X connect 11 0 6 0;
#X connect 12 0 6 0;
#X connect 13 0 20 0;
#X connect 14 0 21 0;
#X connect 15 0 14 0;
#X connect 18 0 9 0;
#X connect 18 0 12 0;
#X connect 18 0 5 0;
#X connect 18 1 7 0;
#X connect 18 1 11 0;
#X connect 18 2 20 0;
#X connect 18 3 15 0;
#X connect 20 0 19 0;
#X connect 21 0 22 0;
#X restore 18 434 pd recorder;
#X msg 18 320 record 1;
#X msg 18 363 stop;
#N canvas 359 226 666 626 playback 0;
#X obj 20 45 line~;
#X obj 39 237 line~;
#X obj 20 268 *~;
#X obj 39 208 r cutoff;
#X obj 20 16 r phase;
#X obj 20 592 outlet~;
#X obj 20 564 hip~ 5;
#X obj 32 79 r sample-number;
#X obj 32 108 makefilename sample%d;
#X msg 32 136 set \$1;
#X obj 20 177 tabread4~ sample1;
#X obj 38 304 r envelope;
#X obj 38 362 dbtorms;
#X obj 38 333 unpack;
#X obj 38 391 sqrt;
#X obj 38 420 sqrt;
#X obj 38 448 line~;
#X obj 20 535 *~;
#X obj 38 477 *~;
#X obj 38 506 *~;
#X text 90 17 messages to the phase generating line~;
#X text 171 80 setting the sample number.;
#X text 221 109 compute the name;
#X text 93 137 and send a "set" message to the tabread4~.;
#X text 99 236 line~ for de-clicking;
#X text 139 307 The envelope generator. Rather than sending our message
straight to the line~ we unpack it in order to fool with the amplitude
field.;
#X text 109 363 convert amplitude to linear units.;
#X text 104 392 take the fourth root. This because we want to raies
the line~'s output to the 4th power afterward. This is an inexpensive
way to give the rise and decay a more natural sounding evolution than
just a straight line.;
#X text 77 480 square the output twice to get the fourth power.;
#X connect 0 0 10 0;
#X connect 1 0 2 1;
#X connect 2 0 17 0;
#X connect 3 0 1 0;
#X connect 4 0 0 0;
#X connect 6 0 5 0;
#X connect 7 0 8 0;
#X connect 8 0 9 0;
#X connect 9 0 10 0;
#X connect 10 0 2 0;
#X connect 11 0 13 0;
#X connect 12 0 14 0;
#X connect 13 0 12 0;
#X connect 13 1 16 1;
#X connect 14 0 15 0;
#X connect 15 0 16 0;
#X connect 16 0 18 0;
#X connect 16 0 18 1;
#X connect 17 0 6 0;
#X connect 18 0 19 0;
#X connect 18 0 19 1;
#X connect 19 0 17 1;
#X restore 18 461 pd playback;
#X msg 18 341 record 2;
#X text 565 45 ARGUMENTS FOR NOTES:;
#X text 586 73 pitch in halftones;
#X text 586 97 amplitude (dB);
#X text 586 145 sample number;
#X text 586 121 duration (msec);
#X text 586 169 start location (msec);
#X text 586 193 rise time (msec);
#X text 586 217 decay time (msec);
#X obj 313 87 unpack 0 0 0 0 0 0 0;
#X obj 471 193 f;
#X obj 406 167 f;
#X obj 337 167 f;
#X obj 300 167 f;
#X obj 268 167 f;
#X obj 174 167 f;
#X obj 174 194 mtof;
#X obj 174 222 / 261.62;
#X obj 174 249 * 4.41e+08;
#X obj 174 277 +;
#X obj 439 167 delay;
#X obj 268 337 pack 0 0 0 0 0;
#X obj 207 87 t b b b;
#X text 408 371 This starts the note \, sending to "receives" in the
playback subptach. The new receive "envelope" is an amplitude control
in parallel with the cutoff control. The "sample-number" switches the
tabread4~ between tables.;
#X msg 106 69 \; pd dsp 1 \; cutoff 0 5;
#X obj 337 222 + 1;
#X msg 416 487 60 100 10000 1 0 0 0;
#X obj 416 758 s note;
#X msg 471 221 \; envelope 0 \$1;
#X msg 535 698 62;
#X msg 570 698 64;
#X msg 501 698 60;
#X msg 472 698 55;
#X msg 603 698 72;
#X msg 440 698 48;
#X msg 502 741 60.5;
#X msg 416 514 60 90 10000 1 0 0 0;
#X msg 416 541 60 100 10000 2 0 0 0;
#X msg 416 568 60 100 10000 1 3000 0 0;
#X obj 337 194 * 44.1;
#X msg 416 622 60 100 100 1 0 0 0;
#X msg 416 649 60 100 100 1 0 0 1000;
#X msg 416 595 60 100 10000 1 0 1000 0;
#X msg 268 365 \; envelope 0 \, \$1 \$2 \; phase \$3 \, \$4 1e+07 \;
sample-number \$5 \; cutoff 1 5 \;;
#X text 80 320 <-- record;
#X msg 18 385 reload;
#X msg 18 406 browse;
#X text 15 184 transposition works;
#X text 15 198 by altering the phase;
#X text 15 240 calculate speed change;
#X text 15 254 considering 60 as unity.;
#X text 15 74 as before we;
#X text 15 89 mute and wait;
#X text 15 212 target (\$4 below right.);
#X text 370 328 combine amplitude \, rise time \, start phase \, end
phase \, and sample number in one message;
#X text 574 487 straight playback;
#X text 574 513 change amplitude;
#X text 574 540 change sample number;
#X text 574 568 change start location;
#X text 574 595 change rise time;
#X text 574 622 change duration;
#X text 573 649 ... and decay time;
#X text 539 741 microtones OK too.;
#X text 439 677 If you omit values they stay unchanged;
#X text 412 449 Here are buttons to demonstrate the effect of varying
the parameters one by one.;
#X obj 19 492 output~;
#X text 16 560 This patch take the same principle as the earlier "one-shot
sampler" \, but allows you to parametrize sample playback. Since we
must wait 5 msec before starting the playback \, we store all the parameters
in "f" objects \, and recall them to construct the new note. Transposition
is done by altering the amount to play back in the (artificial) ten
thousand seconds (1e+07). The playback segment can be altered to start
in the middle of the sample instead of the beginning \, and you can
change the duration and rise and decay times.;
#X obj 1 1 cnv 15 445 20 empty \$0-pddp.cnv.header chocolate_sampler
20 10 1 18 -261139 -33289 0;
#X obj 407 2 pddp/pddplink http://puredata.info/dev/pddp -text pddp
;
#X text 15 226 The [mtof] and / 261;
#X obj 1 796 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 chocolate sampler;
#X restore 392 798 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 chocolate sampler- Related Help Documents;
#X text 19 37 links:;
#X restore 103 798 pd References;
#X obj 6 798 pddp/pddplink ../5.reference/pddp/help.pd -text help;
#X connect 0 0 1 0;
#X connect 0 0 33 0;
#X connect 1 0 31 0;
#X connect 3 0 18 0;
#X connect 6 0 5 0;
#X connect 7 0 5 0;
#X connect 8 0 74 0;
#X connect 8 0 74 1;
#X connect 9 0 5 0;
#X connect 18 0 24 1;
#X connect 18 0 0 0;
#X connect 18 1 23 1;
#X connect 18 2 29 1;
#X connect 18 3 22 1;
#X connect 18 4 21 1;
#X connect 18 5 20 1;
#X connect 18 6 19 1;
#X connect 19 0 37 0;
#X connect 20 0 30 1;
#X connect 21 0 48 0;
#X connect 22 0 30 4;
#X connect 23 0 30 0;
#X connect 24 0 25 0;
#X connect 25 0 26 0;
#X connect 26 0 27 0;
#X connect 27 0 28 0;
#X connect 28 0 30 3;
#X connect 29 0 19 0;
#X connect 30 0 52 0;
#X connect 31 0 23 0;
#X connect 31 1 24 0;
#X connect 31 2 20 0;
#X connect 31 2 21 0;
#X connect 31 2 22 0;
#X connect 31 2 29 0;
#X connect 34 0 30 2;
#X connect 34 0 28 1;
#X connect 35 0 36 0;
#X connect 38 0 36 0;
#X connect 39 0 36 0;
#X connect 40 0 36 0;
#X connect 41 0 36 0;
#X connect 42 0 36 0;
#X connect 43 0 36 0;
#X connect 44 0 36 0;
#X connect 45 0 36 0;
#X connect 46 0 36 0;
#X connect 47 0 36 0;
#X connect 48 0 34 0;
#X connect 49 0 36 0;
#X connect 50 0 36 0;
#X connect 51 0 36 0;
#X connect 54 0 5 0;
#X connect 55 0 5 0;
