OSC (Open Sound Control) is a protocol for sending and receiving information to and from software or hardware. Some electronic musical instruments support it, as well as many software applications. In addition, there are several mobile apps (e.g. OSCemote) that can communicate via OSC over wireless connections. AnalogIn and DigitalIn can receive OSC messages from any OSC compatible software or device, and AnalogOut and DigitalOut can send OSC to any software or device.

Receiving OSC

The IN widgets will read a value after the main OSC string if the string matches what’s specified in oscString.

Set up the AnalogIn or DigitalIn widget for receiving OSC:

  • Set the controller parameter to “osc”
  • Set the oscString parameter to match what the sending system outputs (more below on this), e.g. “/slider/1”
  • Set the oscMultiplier to a number that will scale the incoming values to your application needs
  • If you want to receive something other than the first value included in the incoming OSC message, set the controllerInputNum parameter to the number of the OSC argument (starting at 0).

It will multiply this value by the oscMultiplier specified in the widget parameters. So for example, if you use the iPhone app OSCemote, the Sliders send a message such as:

/slider/1 0.3

In this case, you would set the oscString parameter to “/slider/1”, and the multiplier to 1023. AnalogIn will then convert the numbers OSCemote sends (which are between 0 and 1), and convert them to the full range of the widget (0-1023).

To make the AnalogIn widget communicate correctly with the sender of OSC, you’ll need to know the IP address and Port the device/software is communicating on – which are set in AnalogIn’s controllerIP and controllerPort parameters. You’ll also need to know the IP address where the Hub is running – these will be set in the device/software settings or specified in the manual. If your OSC sender is on the same computer, then use, which means the localhost or current computer. For port, a good default to use is 9000.

Multiple Arguments
Sometimes, OSC messages have multiple arguments. For example, with OSCemote, all three axes the accelerometer data is sent in one message like this:

/acceleration/xyz 0.1 0.2 0.3

Use the controllerInputNum parameter to select which argument to use. Zero sets it the first value (in this case X=0.1). If controllerInputNum is set to 2, AnalogIn would listen for the third value of Z=0.3.

It is also possible to get all values sent to AnalogIn using the multiInput code interface. For more info, see the bottom of the AnalogIn page.

Negative Values
In some cases, OSC messages include negative values. Using the OSCemote example again for accelerometer data, the values range from -3 to +3, where 0 is level for that axis. To take full advantage of the positive and negative values (and assuming you have the oscMultiplier set to the default of 1023), you should set ceiling to 3096 and floor to -3096 (i.e. 3 * 1023 and 3 * -1023).

Sending OSC

The AnalogOut and DigitalOut widgets both support sending a single to any OSC compatible software or device. AnalogOut also can send multiple values using the sendOutput(“23 488 2828”) code interface documented on the AnalogOut page.

Set up AnalogOut or DigitalOut to send OSC:

  • Set the controller parameter to “osc”
  • Set the oscString parameter to match what the receiving system wants to see e.g. “/slider/1”
  • Set the multiplier to a number that will scale the outgoing values to the receiver’s needs (which are often fractional), such as 0.000977 which will divide the number by 1023.

OSCemote (iOS application)

In OSCemote, go to the Settings menu and find out what the Listen IP address is. Type this number in the the parameter controllerIP. The Port used is somewhat arbitrary, but usually 8000 is a good number to use. Type the port you select into the controllerPort parameter. You’ll need to enter similar numbers in the OSCemote app, where the To: IP will be the IP address of your computer. Make the Port on OSCemote the same in both cases, matching what you put into the AnalogIn widget controllerPort parameter.

For a complete list of the messages that OSCemote sends, go to this page:


Osculator and Wiimote

AnalogInput can receive sensor data from the Wiimote and other devices supported by Osculator. This works through a system in Osculator called OSC Forwarding. Osculator sends the values to AnalogIn (via the Hub) by formatting a special OSC message. To use the Wiimote or other device, do the following:

Configure Osculator for OSC Forwarding

  • Download Osculator
  • Open Osculator, and select the Parameters panel (see Osculator docs on OSC Routing – their page is a bit out of date in terms of the interface, but the information will still help – my instructions and image below are more up-to-date)
  • In the top section with the numbers pull down the Gear icon and select localhost:9000 for number 1
  • In the lower section, where it says Rewrite address, click on the “+”
  • With the new entry under the “#”, select 1
  • Click where it says “same address” and in the dialog that opens, set the rewrite address to “/netlabwidget” (you can use any text in this format, as long as you match it in the oscString in the widget parameters)
  • Close the rewrite panel, and the select OK in the OSC Hosts panel
  • Pair your Wiimote as documented here: http://www.osculator.net/dw/manual:wiimote
  • Once the Wiimote (or other device) is sending data to Osculator, on the line for the value you want (e.g. pitch), under the Event Type column, pull down and select OSC Routing
  • In the Value column, select the host you create earlier, e.g. “localhost:9000 -> /netlabwidget”

Configure the AnalogInput Widget

  • In Flash, select the AnalogIn widget parameters
  • Set controllerIP to
  • Set controllerPort to 9000
  • Set oscString to “/netlabwidget” (or whatever you set it to in Osculator)


Last modified March 7th, 2012