I wan to store the 256 values that java send to pd in a table. I construct a conter from 0 to 255 to write the values using [tabwrite] but I haven´t yet put them inside the table. Anybody could help me? I don´t know what is missing ...
-
Write table with 256 values coming from a number b
-
I'm guessing your patch receives the 256 values in a list?
You can extract the Nth element from a list with a message box like [ $N (
But for a list length 256 this could get tedious to patch. What I suggest is making a Java program to make the patch.
Make a patch to extract the right parts from the list for a short list, say length 4, perhaps with a [ t l l l l] connected up to [ $N M (, where M=N-1, each connected to [ unpack f f ( ==> [ tabwrite ] . If you create the message boxes last, it will be easier to write the program.
Then write a Java program to generate the patch you want. It's best if the patch generated is a complete abstraction, so you don't have to edit the output patch each time you edit the Java program (say if you want different length lists).
Here is an example of a Java program that I wrote to generate a patch with 256 number boxes in a 4x64 grid. It doesn't follow my guidelines for being a complete abstraction - I edited the patch afterwards to add more stuff, which will cause me problems next time I want a different sized grid....
----snip-----
public class NumberGrid4x64 {
public static void main(String args[]) {
System.out.println("#N canvas 403 0 525 1216 10;");
int count = 0;
System.out.println("#X obj 2 18 cnv 15 110 1136 empty \\$0-canvas-r \\$1 4 12 0 10 -225280 -90133 0;"); count++;
for(int y = 0; y < 64; y++) {
for(int x = 0; x < 4; x++) {
System.out.println("#X floatatom "+(7+26*x)+" "+(42+16*y+4*((int)(y/4))+4*((int)(y/16)))+" 3 0 0 0 - #0-"+y+"-"+x+"-r #0-"+y+"-"+x+"-s;"); count++;
}
}
int count0 = count;
for(int y = 0; y < 64; y++) {
for(int x = 0; x < 4; x++) {
System.out.println("#X obj "+(120+200*x)+" "+(42+16*y+4*((int)(y/4))+4*((int)(y/16)))+" r \\$0-"+y+"-"+x+"-s;"); count++;
System.out.println("#X msg "+(220+200*x)+" "+(42+16*y+4*((int)(y/4))+4*((int)(y/16)))+" "+y+" "+x+" \\$1;"); count++;
}
}
int count1 = count;
System.out.println("#X obj "+(500)+" "+(18)+" t a;");
for(int c = count0; c < count1; c = c + 2) {
System.out.println("#X connect "+(c)+" 0 "+(c+1)+" 0;");
System.out.println("#X connect "+(c+1)+" 0 "+count1+" 0;");
}
}
}
----snip---- -
Sorry I forget to tell ... I receive the values from the netserver outputs in a number box.
-
So one another the other because I connect a [print ola] and I can see the values in sequence in the black screen of pd.
-
Thanks for your help but I´m still very confused ...
I try your java program but I don´t understood ...
I try to connect a [send mi] to the number box that receive values from java in sequence, I suppose in pd we name this kind of object - list - but I´m not sure. Then a connect a [receive mi] with a [t f], a [unpack] and in the end [tabwrite array_256]. In the right inlet of tabwrite I connect a cycle from 1 to 256.
When I see the content of table array_256 a can perceive that I have some values from the java connection and others I don´t know from where they appeared. I suppose it´s a questions of syncronization. Anybody could help me?