luisalamas@sapo.pt wrote:
Thank for your support ...
thanks for the ascii-mail. but please reply not only to me but to the whole list. other people might be interested as well.
I will send in attachment the patch (FinalServer.pd)
i see.
i am still not sure what you want to achieve in the first place: i can think of 2 possibilities: a) each time you get a value from [netserver] you write this value to the table and increment the index by one ("asynchronous"); after the table is full you re-start at the beginning i guess this is not what you want b) a counter increments the index according to a reference clock. whenever a value comes in from [netserver] it is inserted at the "correct" place in the table ("synchronous"); i guess this is more what you want.
your patch does following: a new value comes in you start a clocked index-counter ([metro]) that counts *quite fast* (but *not* immediatly) from 0. "in the meanwhile" you send the "value" to the first inlet of the [tabwrite]; as the index (2nd inlet) happens to be 0, you write this value into the first element of the array. the counter continues to increment the index each dsp-tick (the "grain" of pd's message system) until it reaches 256 and then stops. if nothing comes in in this time (1.3ms*256) the result would be: the value is stored in the first element of the table; the rest of the table is untouched. if a value arives while the counter is still counting, this value will be inserted at the "current" index (which is a function of time but looks rather random)
what is going wrong ? your index-counter does not behave well (i think, but of course i might be wrong)
for scenario-a use something like
| [t f b] _______ | | | | | [i] | | | | | [+ 1] | | | | | [% 256] | | |_______| | | [tabwrite bla]
for scenario-b you should detach the clock of the counter entirely from your input values. and just as a tip, try to make the index the "master" that defines the time, when a new value is inserted. and why do you run metro at full speed ?
[tgl] | [metro 10] | [i]/[+ 1]/[% 256] | | [netserver] | | [pack] | [$2 $1( | [tabwrite bla]
oh, i tried to not give the full solution...
mfg.a.sdr IOhannes
original patch: #N canvas 344 21 944 851 12; #X symbolatom 221 252 10 0 0; #X floatatom 182 292 5 0 0; #X floatatom 153 328 5 0 0; #X text 266 271 IP do cliente; #X text 216 312 numero do sockect; #X text 183 346 numero de ligacoes; #X text 60 374 dados recebidos; #X obj 553 272 route float list; #X obj 620 338 print list; #X floatatom 548 368 5 0 0; #X obj 688 315 print anything; #X floatatom 654 228 5 0 0; #X msg 523 103 connect localhost 3000; #X msg 586 143 disconnect; #X floatatom 57 358 5 0 0; #X obj 584 193 netclient; #X msg 100 96 client 1 234 ;; #X msg 218 136 client 2 418 ;; #X msg 458 56 send 18 ;; #X msg 51 69 print ;; #X obj 82 209 netserver 3000; #X obj 10 424 print ola; #X obj 13 661 table vermelho 256; #X text -10 702 array de 256x1 de valores que se chama vermelho; #X obj 73 767 tabread vermelho; #X floatatom 25 818 5 0 0; #X msg 418 572 bang; #X obj 418 602 metro; #X msg 358 608 0; #X obj 418 637 float; #X obj 511 640 + 1; #X floatatom 511 678 5 0 0; #X obj 514 713 moses 257; #X msg 490 571 stop; #X obj 11 605 tabwrite vermelho; #X text 407 738 contador de 256 valores; #X obj 213 506 f; #X obj 252 507 mod 257; #X obj 330 508 + 1; #X obj 207 469 metro; #X floatatom 212 535 5 0 0; #X msg 196 436 stop; #X msg 114 426 bang; #X obj 240 573 moses 256; #X floatatom 42 733 5 0 0; #X obj -15 445 s mi; #X obj -17 482 r mi; #X obj 112 810 print vermelho; #X obj 2 520 t f; #X obj -4 552 unpack; #X connect 7 0 9 0; #X connect 7 1 8 0; #X connect 7 2 10 0; #X connect 12 0 15 0; #X connect 13 0 15 0; #X connect 14 0 21 0; #X connect 14 0 42 0; #X connect 14 0 45 0; #X connect 15 0 7 0; #X connect 15 1 11 0; #X connect 16 0 20 0; #X connect 17 0 20 0; #X connect 18 0 15 0; #X connect 19 0 20 0; #X connect 20 0 14 0; #X connect 20 1 2 0; #X connect 20 2 1 0; #X connect 20 3 0 0; #X connect 24 0 25 0; #X connect 24 0 47 0; #X connect 26 0 27 0; #X connect 26 0 28 0; #X connect 27 0 29 0; #X connect 28 0 29 1; #X connect 29 0 30 0; #X connect 30 0 29 1; #X connect 30 0 31 0; #X connect 31 0 32 0; #X connect 32 0 44 0; #X connect 32 1 33 0; #X connect 33 0 27 0; #X connect 36 0 38 0; #X connect 36 0 34 1; #X connect 36 0 40 0; #X connect 37 0 36 1; #X connect 38 0 37 0; #X connect 39 0 36 0; #X connect 40 0 43 0; #X connect 41 0 39 0; #X connect 42 0 39 0; #X connect 43 1 41 0; #X connect 44 0 24 0; #X connect 46 0 48 0; #X connect 48 0 49 0; #X connect 49 0 34 0;