diff options
Diffstat (limited to 'pd/doc/3.audio.examples/D11.sampler.poly.pd')
-rw-r--r-- | pd/doc/3.audio.examples/D11.sampler.poly.pd | 175 |
1 files changed, 175 insertions, 0 deletions
diff --git a/pd/doc/3.audio.examples/D11.sampler.poly.pd b/pd/doc/3.audio.examples/D11.sampler.poly.pd new file mode 100644 index 00000000..60aa7377 --- /dev/null +++ b/pd/doc/3.audio.examples/D11.sampler.poly.pd @@ -0,0 +1,175 @@ +#N canvas 66 253 1119 674 12; +#N canvas 0 0 600 392 samples 0; +#N canvas 0 0 450 300 graph1 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 graph1 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 931 97 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 obj 26 88 makefilename sample%1; +#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 connect 0 0 13 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 9 0; +#X connect 13 0 12 0; +#X connect 13 0 5 0; +#X connect 13 1 7 0; +#X connect 13 1 11 0; +#X connect 13 2 20 0; +#X connect 13 3 16 0; +#X connect 14 0 20 0; +#X connect 15 0 21 0; +#X connect 16 0 15 0; +#X connect 20 0 19 0; +#X connect 21 0 22 0; +#X restore 931 284 pd recorder; +#X msg 931 146 record 1; +#X msg 931 202 stop; +#X msg 931 174 record 2; +#X text 19 49 ARGUMENTS FOR NOTES:; +#X text 19 71 pitch in halftones; +#X text 19 95 amplitude (dB); +#X text 19 143 sample number; +#X text 19 119 duration (msec); +#X text 19 167 start location (msec); +#X text 19 191 rise time (msec); +#X text 19 215 decay time (msec); +#X msg 931 229 reload; +#X msg 931 257 browse; +#X text 47 10 POLYPHONIC SAMPLER; +#X obj 547 522 sampvoice; +#X obj 547 494 sampvoice; +#X obj 547 467 sampvoice; +#X obj 547 439 sampvoice; +#X obj 547 412 sampvoice; +#X obj 547 384 sampvoice; +#X obj 547 356 sampvoice; +#X obj 547 329 sampvoice; +#X obj 631 17 r note; +#X obj 631 44 unpack 0 0 0 0 0 0 0; +#X obj 604 76 t b f; +#X obj 544 109 f; +#X obj 580 109 + 1; +#X obj 552 146 mod 1e+06; +#X obj 544 175 makenote 64; +#X obj 544 203 poly 8 1; +#X obj 544 230 stripnote; +#X obj 617 272 pack 0 0 0 0 0 0 0 0; +#X obj 617 300 route 1 2 3 4 5 6 7 8; +#X text 929 124 record \, etc.; +#X text 335 203 allocate sampler voice; +#X text 361 228 drop note off again; +#X obj 704 516 qlist; +#X obj 870 520 r comment; +#X text 732 445 sailors to untie him...; +#X text 735 395 Lashed to the mast of his boat \, Ulysses; +#X text 735 420 hears beautiful singing. He begs his; +#X text 7 263 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 8 413 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 8 515 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 text 854 639 updated for Pd version 0.33; +#X msg 704 486 read qlist-sampler.txt \, rewind \, tempo 1 \, bang +; +#X obj 548 551 output~; +#X text 249 108 increment mod 1e+06 to make tag; +#X text 276 127 (acts like a MIDI pitch to; +#X text 277 146 identify the note to "poly"); +#X text 258 175 supply delayed note-off message; +#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 16 0 48 0; +#X connect 16 0 48 1; +#X connect 17 0 16 0; +#X connect 18 0 17 0; +#X connect 19 0 18 0; +#X connect 20 0 19 0; +#X connect 21 0 20 0; +#X connect 22 0 21 0; +#X connect 23 0 22 0; +#X connect 24 0 25 0; +#X connect 25 0 26 0; +#X connect 25 1 33 2; +#X connect 25 2 30 2; +#X connect 25 2 33 3; +#X connect 25 3 33 4; +#X connect 25 4 33 5; +#X connect 25 5 33 6; +#X connect 25 6 33 7; +#X connect 26 0 27 0; +#X connect 26 1 33 1; +#X connect 27 0 28 0; +#X connect 27 0 30 0; +#X connect 28 0 29 0; +#X connect 29 0 27 1; +#X connect 30 0 31 0; +#X connect 30 1 31 1; +#X connect 31 0 32 0; +#X connect 31 2 32 1; +#X connect 32 0 33 0; +#X connect 33 0 34 0; +#X connect 34 0 23 1; +#X connect 34 1 22 1; +#X connect 34 2 21 1; +#X connect 34 3 20 1; +#X connect 34 4 19 1; +#X connect 34 5 18 1; +#X connect 34 6 17 1; +#X connect 34 7 16 1; +#X connect 47 0 38 0; |