OSC in Field

Open Sound Control (or OSC to its friends) is a popular network protocol used to send information between applications. Often seen as the “spiritual successor” to MIDI, it’s a very simple protocol that’s been adopted as a simple, useful glue. A wide variety of products, programming environments and languages, apps and bits of hardware can send and/or receive OSC messages of various kinds. Just this year, I’ve used it to send the head position and orientaiton of a VR headset to sound spatialization code (running in Max), control playback and scrubbing of a soundtrack in Ableton, and to control graphics from Field from an ipad.

For example — want to push buttons on a cell phone (or get gyroscope information off of one)? There’s an app that sends OSC. Want to send ‘notes’ and control information to Ableton Live, Max 8 or VCV Rack?, Send OSC from automation tracks in Logic Pro? TouchDesigner even Unity?

Various programming languages make sending and recieveing OSC easy as well. Python, Processing, SuperCollider and so on…

Field is no exception. Let’s send a number from Field over OSC to something. Three lines:

// cheat-code to enable OSC output
var OSCOut = Java.type("trace.sound.OSCOut")

// open an OSC connection to port 7001
var osc = new OSCOut(7001)

// send the number 42.3 to /data/ch/1
osc.send("/data/ch/1", 42.3)

That’s it! Three benefits of OSC over other protocols. One, it’s ‘stateless’, which is just a fancy way of saying that the two parties to this communication don’t have to speak to each other first before the communication channel is ready for use — Field sends out /data/ch/1 = 42.3 to anybody (or nobody) listening on port 7001 on the same computer. Secondly, it makes no description of what the data means — it’s up to the code listening to interpret both the 42.3 and the /data/ch/1. As long as the ‘address’ is separated by (and starts with) ‘/’s its a valid thing to set. Finally, it works over ethernet both local to a machine and between computers in the same way. This alows you to hack on a laptop and then, when you are ready for a performance, separate out the processing across multiple computers — graphics on one machine, sound on another, for example.

This means that code like this:

var Hands = Java.type("auw.misc.Hands")
var OSCOut = Java.type("trace.sound.OSCOut")

var osc = new OSCOut(7001)

// every frame in our animation loop
while(_.stage.frame())
{
	var q = Hands.joints["L_2_metacarpal"]
	if (q) {
		osc.send("/data/ch/1", q.y/200)
		osc.send("/data/ch/2", q.x/20)
		osc.send("/data/ch/3", q.z/20)
	}
}

Which reads the position of a finger joint from a Leap camera, can build a weird Theramin using, say, VCV Rack :

It’s also worth thinking a little about what’s going on here. VCV Rack doesn’t have ‘Theramin’ support, it doesn’t have ‘Leap Motion’ support, it doesn’t have Javascript support (it barely has ‘divide by 20’ support). Field doesn’t have “pretend Eurorack modular synth” support. Neither product is seeking to colonize the other, muscle it’s way ontop of the product description of a competitor. They simply sit their doing what they do best, sharing the little bit of information that they need to collaborated with the very minimum of fuss.