Hello guys im allso new to SuperCollider , it was assign to me in a class as a final exam to connect the SuperCollider with Proccesing, more precisely i want to send a custom synth from supercolllider to proccesing that plays the beat of the song Blinding Lights and in supercollider and then we can send it to proccesing. In proccesing you see the lyrics of the song and they change collour acording to the beat
all of this goes well in theory but i cannot send a simple message from supper to proccesing .
Do you know a piece of code or something that could help ?
Thank you in advance for giving time
It depends where the trigger originates - if you create a trigger on the server you can use SendReply | SuperCollider 3.13.0 Help to send an OSC message from the server/scsynth to the language/sclang.
From within sclang, you can use OSCdef | SuperCollider 3.13.0 Help to receive OSC messages from anywhere, so also from the server.
With a given NetAddr
, you can use sendMsg
to send an OSC message to another OSC client, such as Processing.
Within Processing, you need to accept such a message via e.g. the oscP5
library.
Some example code
(
// create a trigger on the server and send it to the language
Ndef(\myTrigger, {
var trig = Impulse.ar(1.0);
SendReply.ar(trig: trig, cmdName: "/myTrig", values: 1.0)
});
)
(
// receive the message
OSCdef(\myTrigReceiver, {|m| m.postln}, path: "/myTrig")
)
(
// forward the msg to another client
n = NetAddr("127.0.0.1", port: 12345);
OSCdef(\myTrigReceiver, {|m|
// 4th element is the value send from the server
n.sendMsg(m[3].postln);
}, path: "/myTrig")
)
// or if you use patterns, you can use Pfunc
(
Pdef(\myPattern, Pbind(
\dur, 1.0,
\freq, Pseq([200, 400], inf),
\myCallback, Pfunc({|e| n.sendMsg(e.freq.postln) }),
)).play;
)
Hope this help you to get started.
2 Likes