Open Sound Control


Open Sound Control (OSC) is a protocol for sending control infomation across a network.
Using OSC in SuperCollider involves four classes. See their help files for more information.
OSCNode, OSCPort, OSCInPort, OSCOutPort

See also :  [default OSC address space]   [OSC message binary format].

Here's a short example. There are some more examples in the Examples folder in the file
"Open Sound Control examples".

(
// on the receiving machine
var nodes, freqRef;
freqRef = Ref.new(800);
OSCPort.closeAll; // close any open ports.
// create an address space for the port.
nodes = OSCNode.tree([
 [\freq, { arg node, freq;
  freqRef.value = freq;
 }],
 [\start, { arg node;
  { SinOsc.ar(Plug.kr(freqRef), 0, 0.2) }.play
 }]
]);
// open an input port
OSCInPort(57123, nodes);
)

//.........

(
// on the sending machine
var hostname;
hostname = "127.0.0.1"// set this to the address of the receiving machine
// open output port
z = OSCOutPort(57123, hostname);
)

// execute these one at a time on the sending machine

z.send("/start");

z.send("/freq", 1200);

z.send("/freq", 700);

z.send("/freq", 800);

z.send("/sc/stop");

z.send("#bundle", 0, [["/freq", 900],["/start"]]);

z.send("/sc/stop");

z.close;


This page was created by SimpleText2Html 1.0.3 on 26-Jul-100.