[PD] dynamic/live array sizing according to sample lengths

Ben Carney bfcarney at gmail.com
Tue Nov 13 08:50:54 CET 2007


I have attatched the patch illustrating this technique as a text file,
I would love to hear feedback,
maybe I have done it a more difficult way?
any comment s wouold be awesome as I have been racking my brain
 with this for quite sometime and am overjoyed to have found the
answer, (thanks once again Rodrigo)


patch starts below
_______________________________________________



#N canvas 299 350 976 762 10;
#X msg 257 225 \; \$1 resize \$2;
#X obj 257 203 pack s f;
#X obj 257 132 bng 15 250 50 0 empty empty empty 0 -6 0 10 -262144
-1 -1;
#X obj 258 158 pack \$0 f;
#X obj 310 26 r num;
#X floatatom 306 61 10 0 0 0 - - -;
#X obj 218 36 r samplebang;
#X obj 38 35 openpanel;
#X obj 100 97 table array1;
#X obj 38 136 soundfiler;
#X obj 82 57 loadbang;
#X obj 38 97 pack s f;
#X obj 83 76 f \$0;
#X floatatom 44 186 10 0 0 0 - - -;
#X obj 38 13 bng 15 250 50 0 empty empty empty 0 -6 0 10 -262144 -1
-1;
#X msg 39 117 read -resize \$1 array1;
#X obj 47 235 s num;
#X msg 257 179 \$1-livetable \$2;
#X obj 180 385 dac~;
#X obj 181 321 bng 15 250 50 0 empty empty empty 0 -6 0 10 -262144
-1 -1;
#X obj 181 361 tabplay~ array1;
#X obj 245 326 s samplebang;
#X obj 118 204 s num;
#X obj 386 178 table \$0-livetable;
#X text 791 721 ben carney 2007;
#X text 746 734 with help from Rodrigo Trevino-Frenk;
#X text 93 505 so \, this patch doesn'r really sound particularly interesting
as it is just a glorified sample player. infact \, the table "$0- live
table" doesnt even have any audio functionality at this point \, In
a seperate \, more complex patch \, it could be fed another sample
\, this is the only way I have found to dynamically resize the array
according to the sound file being fed to the array. all thanks to the
soundfiler object being able to output the number of samples in a sound
file.;
#X text 615 27 open up livetable's properties and watch the length
of the array as a new sample is fed into array1 \, once the sample
is played in the lowermost bang \, the live table is resized to match
the size of the sample exactly.;
#X obj 610 316 cnv 15 100 60 empty empty empty 20 12 0 14 -233017 -66577
0;
#X connect 1 0 0 0;
#X connect 2 0 3 0;
#X connect 3 0 17 0;
#X connect 4 0 5 0;
#X connect 5 0 3 1;
#X connect 6 0 2 0;
#X connect 6 0 5 0;
#X connect 7 0 11 0;
#X connect 9 0 13 0;
#X connect 10 0 12 0;
#X connect 11 0 15 0;
#X connect 12 0 11 1;
#X connect 13 0 16 0;
#X connect 13 0 22 0;
#X connect 14 0 7 0;
#X connect 15 0 9 0;
#X connect 17 0 1 0;
#X connect 19 0 20 0;
#X connect 19 0 21 0;
#X connect 20 0 18 0;




More information about the Pd-list mailing list