From 74596638015e71aa37e24ae72b0c8f2316e91ca6 Mon Sep 17 00:00:00 2001 From: Pete Shadbolt Date: Mon, 3 May 2021 13:24:59 -0700 Subject: [PATCH] Comms OK between python and supercollider --- osctest.py | 9 +++++++++ sine.scd | 14 +++++++++++++- 2 files changed, 22 insertions(+), 1 deletion(-) create mode 100644 osctest.py diff --git a/osctest.py b/osctest.py new file mode 100644 index 0000000..2431870 --- /dev/null +++ b/osctest.py @@ -0,0 +1,9 @@ +from pythonosc import udp_client +import time + +osc = udp_client.SimpleUDPClient("0.0.0.0", 5005) + +while True: + print("send") + osc.send_message("/radio", 1337) + time.sleep(1) diff --git a/sine.scd b/sine.scd index f5ff184..1d6d4c2 100644 --- a/sine.scd +++ b/sine.scd @@ -1,4 +1,16 @@ s = Server.local; s.waitForBoot { - { SinOsc.ar() }.play; + // Set up OSC communications + thisProcess.openUDPPort(5005); + n = NetAddr.new("0.0.0.0", 5005); + o = OSCFunc({ arg msg, time, addr, recvPort; [msg, time, addr, recvPort].postln; }, '/radio', n); + OSCFunc.trace(true); + + // Start some oscillators + { + var x = SinOsc.ar(MouseX.kr(1, 100)); + SinOsc.ar(300 * x + 800, 0, 0.1) + + + PinkNoise.ar(0.1 * x + 0.1) + }.play; };