Step 3Control TouchOSC Elements from Processing
Once you figure out the basic structure of messages, OSC is a really simple and effective way of talking to all kinds of multimedia devices.
In the setup you'll need to do two things: initialize oscP5 and tell it what port to listen to for incoming messages, as well as declare a remote address (in this case the IP address of the smartphone) and the outgoing port. You can find these two values in the OSC app.
oscP5 = new OscP5(this,8000); // Start oscP5, listening for incoming messages at port 8000
myRemoteLocation = new NetAddress("10.0.1.3",9000); // IP address, outgoing port (taken from the TouchOSC app)
An OSC signal is composed of a message and a value. Let's look at the simple case of turning a TouchOSC LED on and off:
OSCMessage myMessage = new OscMessage("/1/led1"); // <--- where /1 is the first page and /led1 is led1
myMessage.add(1); // <-- assign a value to the message (in this case turn the led on)
oscP5.send(myMessage, myRemoteAddress); // <-- send the message to the remote address
To dim the LED to half of its maximum brightness you just need to send another message exactly as above but with 0.5 instead 1 in the myMessage.add(__).
The oscP5Message example pictured provides a good baseline to work from.
| « Previous Step | Download PDFView All Steps | Next Step » |
![]() |
Add Comment
|














































