Sending arrays from max to sc3~

pikku's icon

Hello , do anybody is using the object sc3~ in max?
I need to send arrays from max to the sc3~ object in max.

this is the code i have inside my sc3~ object

SynthDef("Lin", {arg out=0, freqs = #[1300, 1490, 3587, 1741];
var signal;
signal = LinCongC.ar(freqs[2]);
Out.ar(out, Pan2.ar(signal));
}).send(s);

then im generating my object in max in this way:

sc3 y = Synth("Lin").play

and them im trying to send my arrays from max to sc3~ in this way:

[454, 7767, 7888, 666]
|
|
sc3 y.set("freqs", $1)
|
|
sc3~

but its not working , i tried different conbinations but no luck, how
can i solve this, any idea?

cheers

Pikku

Macciza's icon

Have you checked the help ?
I thought something like this was covered under vars or something in one of the subpatchs . . .
hth
MM

f's icon

hi Pikku,
try this...

Max Patch
Copy patch and select New From Clipboard in Max.

in general it's easier if you use symbols ('') instead of strings ("") because then you can skip the escape characters () in max.

i edited your synthdef a little. freqs[2] means you only use the third value out of the array but i think you meant to have all four frequencies there. and i also added a Splay to spread the four channels out in the stereo field (sc3~ is stereo only).

_f