i'm very sorry about the newb question, but i've been trying to load a sample into the table for some time now.
after reading the control examples and the audio examples im still lost.
even if i take an already made pd patch. and just put a sound file into the same sound folder as the already refferenced sample and change the message box to it's name i still get nothin. i've tried this with the samplers in the audio folder.
anyone have any idea on how to help me?
-
Loading a sample into a table
-
hi again i seem to have a problem with the -resize feature. i can only load the first kick of a drumloop.
here's the patch.. think you can look at it for me?
#N canvas 176 147 568 631 10;
#X msg 30 59 bang;
#X obj 29 167 soundfiler;
#N canvas 0 22 450 300 graph1 0;
#X array array1 302400 float 0;
#X coords 0 1 302399 -1 200 140 1;
#X restore 298 51 graph;
#X obj 30 104 openpanel;
#X msg 29 139 read -resize \$1 array1;
#X obj 67 454 tabwrite~ tabread4-out;
#X floatatom 65 532 0 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 30 566 pd output;
#X msg 100 532 MUTE;
#X text 141 531 <-- output amplitude;
#X obj 30 497 hip~ 5;
#X floatatom 30 196 0 0 0 0 - - -;
#X text 229 387 read from the table;
#X text 79 196 <-- frequency (Hz.);
#X floatatom 58 257 0 0 0 0 - - -;
#X obj 58 290 * 441;
#X obj 30 317 *~ 0;
#X obj 30 347 +~ 1;
#X text 111 422 <-- click to display output;
#X obj 30 228 phasor~ 0;
#X msg 66 419 bang;
#X text 105 256 <-- chunk size (100ths of a second);
#X text 76 316 <-- readjust phase for range 0 - (chunk size);
#X text 75 347 <-- add one to avoid beginning of table;
#X obj 30 384 tabread4~ array1;
#X connect 0 0 3 0;
#X connect 3 0 4 0;
#X connect 4 0 1 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 19 0;
#X connect 14 0 15 0;
#X connect 15 0 16 1;
#X connect 16 0 17 0;
#X connect 17 0 24 0;
#X connect 19 0 16 0;
#X connect 20 0 5 0;
#X connect 24 0 10 0;
#X connect 24 0 5 0; -
loops load fine for me.
i guess your whole loops are loading too, but you're only playing the first bit.
there's a number box which says: "chunk size (100ths of a second)"
even if you set that to 100, you're still only playing the first 1 second of your loop. you want to set it to about 400 to hear a typical 4 second drumloop.
anyway, stick with it. everyone feels really bewildered at first...but you get these aha! moments when things just fall into place in your mind. -
hehe ok cool will do gonna go to bed and try some more tomorrow
-
any idea how i could just have pd auto detect the sample length?
-
the output of [soundfiler] gives the sample length in bits. for a 44100hz sample, divide by 44.1 to give the length in milliseconds
[soundfiler]
|
(sample length comes out here) -
do i put one of these after the soundfiler?
/ 44.1 -
read $1 -resize drum
should be:
read -resize $1 drum
other than that you seem to be doing fine...
what you can now do, is take that bit of code you just made, and use it to load new files into arrays in the help docs. (just swap 'drum' for the array names in the docs)
remember though, if you modify the help files, make sure you save *as a copy* , cos you don't wanna go monging up your documentation. -
interesting.
thanks i'll look into it.