osc in processing

February 26, 2009

if you need to use osc in processing, there is an opensource API that will help you a lot: oscP5. originally created by andreas schledel (who, by the way, has done some successfull tests with processing and wiimotes), oscP5 is very easy to handle with. after downloading and installing it (instructions here), everything you need is to do something like this:

import oscP5.*;

OscP5 oscP5; //for osc communication

void setup()
{
oscP5 = new OscP5(this,12345); //initializing the oscP5 objetc
 }

void draw()
{
//draw anything you want
}

/* incoming osc message are forwarded to the oscEvent method. so everytime a message arrives, this method is called*/
void oscEvent(OscMessage theOscMessage) {
theOscMessage.print(); //do whatever you want with the message
 }


the complete API specification can be found here.

further informations
[1] about processing
[2] about osc
[3] about oscP5

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: