Skip to content

Instantly share code, notes, and snippets.

@tado
Last active March 19, 2021 13:43
Show Gist options
  • Save tado/7082b0884bf033fc0d6c to your computer and use it in GitHub Desktop.
Save tado/7082b0884bf033fc0d6c to your computer and use it in GitHub Desktop.
Send OSC from Tidal
import oscP5.*;
import netP5.*;
OscP5 oscP5;
NetAddress myRemoteLocation;
float x;
float y;
void setup() {
size(600, 600);
frameRate(60);
oscP5 = new OscP5(this, 12000);
myRemoteLocation = new NetAddress("127.0.0.1", 12000);
x = -width;
y = -height;
}
void draw() {
background(0);
noStroke();
fill(255);
ellipse(x, y, 100, 100);
}
void oscEvent(OscMessage theOscMessage) {
if (theOscMessage.checkAddrPattern("/test")==true) {
println("address: "+theOscMessage.addrPattern());
println("values: "
+ theOscMessage.get(0).floatValue() + ", "
+ theOscMessage.get(1).floatValue());
}
x = theOscMessage.get(0).floatValue() * width;
y = theOscMessage.get(1).floatValue() * height;
}
let testosc = OscShape {
path = "/test",
params = [
F "x" (Just 0.5),
F "y" (Just 0.5)
],
cpsStamp = False,
timestamp = NoStamp,
latency = 0,
namedParams = False,
preamble = []
}
testStream = stream "127.0.0.1" 12000 testosc
x = makeF testosc "x"
y = makeF testosc "y"
bps(200/120)
p <- testStream
p $ x "0.1 [0.5 [0.2 0.8]] [0.3 0.7] 0.9" # y "[0.5 0.1] 0.9"
p silence
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment