home/ atoms/ sc-osc-communication

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.

“le. 44OSC OSC(Op enSoundControl)isagreatwaytocommunicateanyk”
corpus · a-gentle-introduction-to-supercollider-bruno-ruviaro · chunk 16
“OSC (Open Sound Control) is a great way to communicate any kind of message between different applications or different computers over a network.”
corpus · a-gentle-introduction-to-supercollider-ruviaro-archive-org-c · chunk 17
“~host = NetAddr("localhost", NetAddr.langPort); // Send an OSC message ~host.sendMsg("/testMsg", "OSCresponderNode test");”
corpus · the-supercollider-book-official-code-examples-scbookcode-gpl · chunk 140