SuperCollider sends and receives OSC messages over UDP, enabling integration with other software and hardware
Open Sound Control (OSC) is SC’s native inter-process protocol. NetAddr(“localhost”, port) represents a destination; .sendMsg(“/path”, arg1, arg2) sends a message; .sendBundle(delay, […]) sends a time-tagged bundle that is executed at a precise future moment. OSCresponderNode (older API) or OSCdef (modern) register listeners for incoming OSC paths. This lets SC communicate with other software (Max/MSP, Processing, Arduino via serial-to-OSC bridges) and receive control data from live performance controllers. The SC server itself uses OSC to communicate with the language.
Examples
~host = NetAddr(“localhost”, NetAddr.langPort); ~host.sendMsg(“/testMsg”, “hello”); ~host.sendBundle(0.2, [“/testMsg”, 42, “string”, pi]); OSCresponderNode(~host, “/testMsg”, { |time, r, msg| msg.postln }).add;
Assessment
Write a patch that listens for /pitch and /amp OSC messages and uses those values to drive a running synth. Send test messages from sclang to itself. Describe the difference between sendMsg and sendBundle.