Open Sound Control (OSC) is a digital music communication protocol and is becoming more and more prevalent in modern audio software. Applications using OSC will have a server listening for messages from a client – this is how FoxDot communicates with SuperCollider to generate audio. Here’s a quick run through of how to send these messages to other OSC applications from FoxDot.
It’s really simple; you just need to tell FoxDot to “forward” any OSC messages. Let’s say your application is running on the local host on port 12345, here’s the code for connecting to it:
And that’s it! Any time FoxDot sends an OSC message to SuperCollider, it will also send it to the other OSC application too. These messages are usually sent as a group together called an “OSC Bundle” which contain a message about the note being played, and also a message for each effect being applied. Here’s what the note message looks like:
[address, synth-name, synth-id, add-action, target-id, arg-1, value-1, arg-2, value-2, ...]
The “address” is basically the name of the function that the OSC application should process the rest of the message with; for SuperCollider this is usually
/s_new and means “trigger synth” and the “synth-name” is name of the SynthDef being triggered. The “synth-id”, “add-action” and “target-id” values relate specifically to SuperCollider so your application can probably ignore these. Then come the arguments used, such as frequency and amplitude, which are written in turn and separated by commas. Here’s what a typical messages might look like
["/s_new", "pluck", 1001, 1, 0, "freq", 440, "amp", 1, "pan", -1, "sus", 1]
So a “pluck” synth is creating a note with an amplitude of 1 at a frequency of 440Hz with a sustain of 1 and a panning of -1. The arguments all relate to the names of keyword arguments used by FoxDot.
If you are getting this error –
FoxDot.lib.OSC3.OSCClientError: while sending: [Errno 111] Connection refused then please check your network connection settings are correct. On Windows this will be ignored but MacOS and Linux will throw this error every time you want to play a note.
For more information about how OSC messages are handled by SuperCollider, here is a link to a great resource on the server command architecture.