Created
July 19, 2017 22:48
-
-
Save JuriaanGregor/131b0bf12cdb31d45dec30e27917a05d to your computer and use it in GitHub Desktop.
Processing and OSC
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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