aboutsummaryrefslogtreecommitdiff
path: root/pd/doc/3.audio.examples/33.sampler.oneshot.pd
diff options
context:
space:
mode:
Diffstat (limited to 'pd/doc/3.audio.examples/33.sampler.oneshot.pd')
-rw-r--r--pd/doc/3.audio.examples/33.sampler.oneshot.pd143
1 files changed, 143 insertions, 0 deletions
diff --git a/pd/doc/3.audio.examples/33.sampler.oneshot.pd b/pd/doc/3.audio.examples/33.sampler.oneshot.pd
new file mode 100644
index 00000000..75ce9153
--- /dev/null
+++ b/pd/doc/3.audio.examples/33.sampler.oneshot.pd
@@ -0,0 +1,143 @@
+#N canvas 34 0 994 773 12;
+#X msg 538 26 \; pd dsp 1;
+#X msg 622 26 \; pd dsp 0;
+#X text 563 64 ON;
+#X text 641 64 OFF;
+#X graph graph1 0 -1.02 176403 1.02 746 290 946 160;
+#X array sample-table 176403 float 0;
+#X pop;
+#X obj 583 520 loadbang;
+#X floatatom 72 407 0 0 0;
+#N canvas 159 26 495 266 output 0;
+#X obj 406 192 t b;
+#X obj 406 132 f;
+#X obj 406 72 inlet;
+#X text 413 35 mute;
+#X obj 406 222 f;
+#X msg 510 214 0;
+#X msg 406 102 bang;
+#X obj 406 162 moses 1;
+#X obj 510 184 t b f;
+#X obj 476 140 moses 1;
+#X obj 100 178 dbtorms;
+#X obj 476 110 r master-lvl;
+#X obj 100 50 r master-lvl;
+#X obj 406 252 s master-lvl;
+#X obj 26 217 inlet~;
+#X obj 239 49 inlet;
+#X text 239 22 level;
+#X obj 239 120 s master-lvl;
+#X msg 115 78 set \$1;
+#X obj 115 107 outlet;
+#X msg 257 77 \; pd dsp 1;
+#X obj 100 233 line~;
+#X obj 26 254 *~;
+#X obj 26 289 dac~;
+#X obj 100 205 pack 0 50;
+#X text 24 190 audio;
+#X text 112 132 show level;
+#X connect 0 0 4 0;
+#X connect 1 0 7 0;
+#X connect 2 0 6 0;
+#X connect 4 0 13 0;
+#X connect 5 0 13 0;
+#X connect 6 0 1 0;
+#X connect 7 0 0 0;
+#X connect 7 1 8 0;
+#X connect 8 0 5 0;
+#X connect 9 1 4 1;
+#X connect 10 0 24 0;
+#X connect 11 0 1 1;
+#X connect 11 0 9 0;
+#X connect 12 0 10 0;
+#X connect 12 0 18 0;
+#X connect 14 0 22 0;
+#X connect 15 0 17 0;
+#X connect 15 0 20 0;
+#X connect 18 0 19 0;
+#X connect 21 0 22 1;
+#X connect 22 0 23 0;
+#X connect 22 0 23 1;
+#X connect 24 0 21 0;
+#X restore 37 440 pd output;
+#X msg 107 407 MUTE;
+#X text 157 406 <-- output amplitude;
+#X obj 37 374 hip~ 5;
+#X obj 37 288 tabread4~ sample-table;
+#X obj 593 379 adc~ 1;
+#X obj 593 409 hip~ 5;
+#X obj 564 473 tabwrite~ sample-table;
+#X msg 564 340 bang;
+#X text 697 525 v-- re-read the original sample;
+#X text 18 15 ONE-SHOT SAMPLER USING LINE~ AS PHASE;
+#X obj 37 258 line~;
+#X obj 77 340 line~;
+#X obj 37 340 *~;
+#X obj 77 313 r cutoff;
+#X obj 37 228 r phase;
+#X msg 130 161 \; phase 1 \, 4.41e+08 1e+07 \; cutoff 1 5;
+#X msg 30 71 bang;
+#X obj 130 126 delay 5;
+#X text 83 71 <-- play the sample;
+#X msg 30 162 \; cutoff 0 5;
+#X text 40 119 cut the;
+#X text 40 138 sound off;
+#X text 210 111 Wait for the;
+#X text 208 131 cutoff to finish;
+#X text 355 155 set the upper line~ to start;
+#X text 355 174 at the first sample and go;
+#X text 354 195 forever (until the next trigger);
+#X text 24 479 In this example we're using a line~ object in place
+of the phaser~-based network that controls read location.;
+#X text 24 520 To start a note \, first we have to mute the output
+in case ther'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 24 636 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 text 602 339 <-- record;
+#X obj 628 439 line~;
+#X obj 593 444 *~;
+#X text 710 328 ------ 4 seconds ------;
+#X msg 551 418 1;
+#X obj 661 376 del 3990;
+#X msg 661 404 0 10;
+#X text 712 405 <--stop recording;
+#X text 25 706 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 text 595 641 this is.;
+#X text 596 615 My apologies to Jonathan Harvey whose bell;
+#X msg 583 550 read ../sound/bell.aiff sample-table;
+#X obj 583 579 soundfiler;
+#X text 725 751 updated for Pd version 0.33;
+#X connect 5 0 49 0;
+#X connect 6 0 7 1;
+#X connect 7 0 6 0;
+#X connect 8 0 7 2;
+#X connect 10 0 7 0;
+#X connect 11 0 20 0;
+#X connect 12 0 13 0;
+#X connect 13 0 40 0;
+#X connect 15 0 14 0;
+#X connect 15 0 43 0;
+#X connect 15 0 42 0;
+#X connect 18 0 11 0;
+#X connect 19 0 20 1;
+#X connect 20 0 10 0;
+#X connect 21 0 19 0;
+#X connect 22 0 18 0;
+#X connect 24 0 27 0;
+#X connect 24 0 25 0;
+#X connect 25 0 23 0;
+#X connect 39 0 40 1;
+#X connect 40 0 14 0;
+#X connect 42 0 39 0;
+#X connect 43 0 44 0;
+#X connect 44 0 39 0;
+#X connect 49 0 50 0;