Does anynone konw if there's a way to enter data sucessfully into an array with a function?
for exaple (from C01nyquist.pd) a message object:
;
table24 sinesum 256 1 0 0 0 1 1 0 0 0 1 0 0 0 1 0 0 0 0 0 1, normalize 0.4
It makes some great sounds and I'd like to be able to change those 0s and 1s just by setting certain keys (key) or notes (notein) so that I can change them on the fly.
I tried using pack but that doesn't seem to be te right object.
cheers
-
Real tmie data entry to an array
-
one way would be to make a seperate message for each variation of the table you want and then use a [select] object to map either keys or notes to those variations. there are other more complex ways to handle the problem, too. for examples, you could have a range of keys on your keyboard act as 'on/off' (1/0) switches for certain positions in the string of numbers. this, however, would involve many a network of triggers and you'd have to make sure messages were sorted in the right time sequence. let me know if you have questions about this second idea (or the first idea, too).
--zac -
I think [pack] is the right object, example with six harmonics:
[bang here when you updated the last six inlets of packl]
|
[symbol sinesum]
|
[pack s 256 0 0 0 0 0 0]
|
[send table24]
If you want to send to the table automatically when a key is pressed, you need a [trigger b b] (left->symbol sinesum, right->toggle->pack inlet) for each key like zac says.
Another method would be to use a [metro] (or even a [bang~] to trigger the pack periodically, which would save all those [trigger]s, but might require more CPU power. -
table25 1 0 0 0 1 1 0 0 0 1 0 0 0 1 0 0 0 0 0 1
---> then, use tabread and a counter and some message boxes to read table25 into one message box
(in a message box) -> sinesum 256 $1 $2 $3 $4.....$20, normalize 0.4
this MIGHT work, with the added bonus that you can draw into table25 if you wish..although it does mean you have to completely redraw table24 everytime you change a note. not sure how practical that will be as i have no experience of sinesum tables.
(you can't just tabwrite to a sinesum table can you????) -
if you have zexy. then try this: (just copy this text into a text file, and rename it 2-tables.pd)
#N canvas 227 120 373 314 10;
#X obj 54 165 tabwrite array25;
#X floatatom 161 117 5 0 19 0 - - -;
#X floatatom 24 117 5 0 1 0 - - -;
#X obj 24 137 t b f;
#X obj 221 195 table array25 20;
#X obj 220 170 table table24;
#N canvas 0 22 633 451 messages-in-a-bottle 0;
#X msg 123 183 sinesum 256 0 0 0 1 0 1 1 0 1 0 0 1 1 0 0 1 0 1 0 0
;
#X obj 122 115 tabdump array25;
#X msg 122 137 add2 \$1 \$2 \$3 \$4 \$5 \$6 \$7 \$8 \$9 \$10 \$11 \$12
\$13 \$14 \$15 \$16 \$17 \$18 \$19 \$20;
#X msg 237 105 set sinesum 256;
#X obj 123 225 s table24;
#X obj 56 68 t b b b b;
#X msg 20 184 normalize 0.4;
#X obj 37 18 inlet;
#X obj 111 21 r set-table;
#X obj 38 326 loadbang;
#X msg 38 349 \; array25 0 0 0 0 1 0 1 1 0 1 0 0 1 1 0 0 1 0 1 0 0
\; set-table bang;
#X connect 0 0 4 0;
#X connect 1 0 2 0;
#X connect 2 0 0 0;
#X connect 3 0 0 0;
#X connect 5 0 6 0;
#X connect 5 1 0 0;
#X connect 5 2 1 0;
#X connect 5 3 3 0;
#X connect 6 0 4 0;
#X connect 7 0 5 0;
#X connect 8 0 5 0;
#X connect 9 0 10 0;
#X restore 24 196 pd messages-in-a-bottle;
#X text 37 239 requires [tabdump] from zexy;
#X text 68 116 value 0/1;
#X text 207 116 position 1-20;
#X connect 1 0 0 1;
#X connect 2 0 3 0;
#X connect 3 0 6 0;
#X connect 3 1 0 0; -
Wow! that was easy!
Thanks so much for your tips. Hardoff, I did the zexy one. it's just the trick. I've now got it set up controlling array25 with my uc-33e. Will probably expand it into a monster now no doubt.
Then learn more about zexy.
cheers