Skip to content

Instantly share code, notes, and snippets.

@JuriaanGregor
Created July 19, 2017 22:48
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save JuriaanGregor/131b0bf12cdb31d45dec30e27917a05d to your computer and use it in GitHub Desktop.
Save JuriaanGregor/131b0bf12cdb31d45dec30e27917a05d to your computer and use it in GitHub Desktop.
Processing and OSC
import netP5.*;
import oscP5.*;
OscP5 oscP5;
NetAddress remoteIP;
void setup() {
size(400, 400);
frameRate(30);
/* Start our sender on the Default Isadora port (1234)*/
oscP5 = new OscP5(this, 1234);
/* Set our remoteIP */
remoteIP = new NetAddress("127.0.0.1", 1234);
}
void draw() {
background(0);
}
void mousePressed() {
/* Create a new bundle that we can fill up */
OscBundle myBundle = new OscBundle();
/* Create a new message object in our bundle with the correct path */
OscMessage myMessage = new OscMessage("/test");
myMessage.add(random(1, 10));
/* Add it back to our bundle */
myBundle.add(myMessage);
myMessage.clear();
/* Send it away ! */
oscP5.send(myBundle, remoteIP);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment