Sending OSC from SuperCollider
For sending OSC from SuperCollider, a NetAddr
object needs to be generated.
It needs an IP address and a port:
Sending Values Once
This first example sends an OSC message once when the following line is evaluated.
The previously created NetAddr object can be used to send OSC messages with its sendMsg
method:
Sending Values Continuously
Based on the previous example, a routine can be created which
continuously reads values from control rate buses to send
their instantaneous value via OSC.
The osc_routine
runs an infinite loop with a short
wait interval to limit the send rate and the CPU load:
~cBus = Bus.control(s,1); ~osc_routine = Routine({ inf.do({ // read value from bus var value = ~cBus.getSynchronous(~nVbap); // send value ~out_address.sendMsg('/oscillator/frequency', value); // wait 0.05.wait; }); });
Once created, the routine can be started and stopped with the
methods play()
and stop()
. While running, bus values
can be changed to test the functionality: