Created
November 10, 2013 18:59
-
-
Save zeffii/7402273 to your computer and use it in GitHub Desktop.
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 oscP5.*; | |
import netP5.*; | |
OscP5 oscP5; | |
/* a NetAddress contains the ip address and port number of a remote location in the network. */ | |
NetAddress myBroadcastLocation; | |
int x = 70; | |
int y = 50; | |
int diameter = 20; | |
int[] radii = {10,10,10,10}; | |
void setup() { | |
size(400,200); | |
frameRate(15); | |
oscP5 = new OscP5(this, 6449); | |
/* the address of the osc broadcast server */ | |
myBroadcastLocation = new NetAddress("127.0.0.1",32000); | |
ellipseMode(RADIUS); | |
} | |
void draw() { | |
background(250); | |
for (int i = 0; i<4; i++){ | |
fill(20); | |
ellipse(90+ (x*i), y, radii[i], radii[i]); | |
} | |
} | |
/* incoming osc message are forwarded to the oscEvent method. */ | |
void oscEvent(OscMessage theOscMessage) { | |
// theOscMessage.addrPattern() | |
// theOscMessage.typetag() | |
theOscMessage.print(); | |
for (int i = 0; i<4; i++){ | |
radii[i] = theOscMessage.get(i).intValue(); | |
} | |
} |
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
fun int df(){ return Math.random2(20,70);} | |
// host name and port | |
"localhost" => string hostname; | |
6449 => int port; | |
// send object, aim the transmitter | |
OscSend xmit; | |
xmit.setHost( hostname, port ); | |
for(0 => int i; i<80; i++){ | |
// start the message... | |
// the type string ',f' expects a single float argument | |
xmit.startMsg( "/processing/trigger/patches", "iiii" ); | |
// a message is kicked as soon as it is complete | |
// - type string is satisfied and bundles are closed | |
df() => xmit.addInt; //instrument | |
df() => xmit.addInt; // track | |
df() => xmit.addInt; // note_val | |
df() => xmit.addInt; // velocity | |
0.31::second => now; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment