OSC format message for arrays and server

classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

OSC format message for arrays and server

Alejandro Olarte
Hi,
I have been trying to compose a message to the server to play an argument array (it will be send from a third application) but I cannot get the right syntax to work already inside sc.
Any help will be more appreciated.

This is what I tried:

//synth from the help
SynthDef(\sin, {Out.ar(0, SinOsc.ar(\freq.kr([300, 330, 370], [1, 0.3, 0.02])).sum * 0.8 )}).add;

// this works
s.sendMsg(\s_new, "sin", 1010,1,1, \freq, $[, 120, 180, 280, $])
s.sendMsg(\n_set, 1010, \freq, $[,180, 240, 220, $])

//but once i compose the array outside the message, it doesn't work anymore
x=[1200, 1400, 2200]
s.sendMsg(\s_new, "sin", 1010, 1, 1, \freq, $[, x, $])

I understand that the array has to be parsed, by which format? I have the idea that a methods like
.asOSCArgArray
.asCompileString
.encodeForOSC

should work but cannot get the right syntax
// trying hacks (ugly, I know, but still it doesn't make the job)
s.sendMsg(\s_new, "sin", 1010, 1, 1, \freq, "$[," ++ x.asString.drop(-1).drop(1) ++ ",$]")

//With the OpenObejct Quark it works tough,

OpenObject.start;
OpenObject.openInterpreter;
n = NetAddr("127.0.0.1", 57120); // loopback IP for this test

SynthDef(\sin, {Out.ar(0, SinOsc.ar(\freq.kr([300, 330, 370], [1, 0.3, 0.02])).sum * 0.8 )}).add;

n.sendMsg("/oo_i", "s.sendMsg('s_new', 'sin', 1010,1,1, 'freq',"++" $[, 120, 180, 280, $])")
n.sendMsg("/oo_i", "s.sendMsg('s_new', 'sin', 1010,1,1, 'freq',"++" $[," ++ Array.rand(3,200,1600).asString.drop(-1).drop(1) ++",$])");

Thanks,
Alejandro
_______________________________________________
sc-users mailing list

info (subscription, etc.): http://www.birmingham.ac.uk/facilities/ea-studios/research/supercollider/mailinglist.aspx
archive: http://www.listarc.bham.ac.uk/marchives/sc-users/
search: http://www.listarc.bham.ac.uk/lists/sc-users/search/
Loading...