Trying to receive OSC messages - SuperCollider to TouchDesigner

I’m very new to TouchDesigner, so I apologize if this is an easy solution. I’m just wondering if TouchDesigner is receiving OSC messages when I play music from SuperCollider.

SuperCollider code:

n = NetAddr(“localhost”, 47120);

The “47120” is the port that messages are being sent from.

I have placed a OSCIN CHOP in TouchDesigner. Here are the current settings:

How can I see that TouchDesigner is receiving the messages when I play music from SuperCollider?

Hi @thedurf18.

the OSC In CHOP will display osc data that has numerical data. Might be good to start with the OSC In DAT which will list all osc data received via the specified port.

The picture below illustrates a bit the issue: osc messages representing numerical data is displayed in both operators while strings are only visible in the OSC In DAT.

Hope this helps
cheers
Markus

Thank you, the DAT seems to be receiving some information. Every time a music note plays I see the number going up.

I’m trying to figure out why I don’t see more information after the number, on the same line, like in your example.

Update: I was able to figure out how to receive messages with text after the number, but I’m not sure what ‘blob’ means or what the numbers are after that, since those numbers aren’t the numbers I’m using in SuperCollider for my frequencies.

I’m playing chords for each musical event. In order to play chords in SuperCollider, I have to ‘nest’ frequency values in an array. It seems TouchDesigner interprets arrays in a certain way, using the word ‘blob’ with all those numbers that I have no idea what they mean. If I play individual notes in SuperCollider, TouchDesigner will accurately just list the single frequency number I’m using.

hi @thedurf18,

I can only guess, but are you using patterns in SC? Perhaps what is being referred to as “blob” is indeed a set of data—since you’re dealing with chords these data might refer to velocity, pitch, etc…

Possibly, SC is also assigning some random names to the data it is sending to TD

Sending OSC from SC is however not as easy as receiving these messages. I prepared and commented a little SC code which connects to a TD patch. The audio signals generated in SC are used to drive some parameters in TD (I have to copy-paste the SC code as part of my comment)

I hope this helps a bit, but if you could post some of your SC code and perhaps the TD patch, that could help!

Cheers

s.reboot
s.quit
//OSC sender–don't forget to set the same port in TouchDesigner
~sendOSC = NetAddr.new("127.0.0.1", 55160)
//we need a variable
~msg ="";

//eternal process–repeats forever!
(fork{
	inf.do{
		//packing the message (2 values, X and Y coords) into an array: OSC tag, value1, value2
		~msg = ["/coords", 0.5, 0.3];
		//sending that bundle over
		~sendOSC.sendMsg(*~msg);
		//wait 1 sec before bringing things back to origin
	1.wait;
		//sending values to bring the object back to origin (now with a more explicit/less bundled syntax)
		~msg = ["/coords", 0.0, 0.0];
		~sendOSC.sendMsg(*~msg);
		//~sendOSC.sendMsg("/coords", 0.0, 0.0);
		//wait another second and repeat the process
	1.wait;}
};)

/**********************************A MORE COMPLEX EXAMPLE**********************************/

//create a 10-channel control bus (just bc we can, as we're not going to use all of these)
~abus = Bus.control(s, 10);
//~abus.free  //just in case we mess things up and need to re-allocate the busses

//synth which is not really meant to provide meaningful audio, but rather populate of control values the busses to TouchDesigner
(SynthDef.new(\testSine, {|outVal, outValAux, audioVal, frequency = 3|
	//creates a sinusoidal signal (audio rate)
	outVal = SinOsc.ar(frequency) * 10;
	//sawtooth signal (audio rate)
	outValAux = Saw.ar(frequency/2)*1.5;
	//a "dummy" sinusoidal signal just for us to make sure something is cooking (we hear a sine: all good!)
	audioVal = SinOsc.ar(200);
	/*we pass to our control bus an array of values, which are stored in the first 2 channels of our 10-channel bus
	NOTE!! Since we're sending audio data to a control bus, the signals are automatically "converted" (downsampled) to kr*/
	Out.kr(~abus, [outVal, outValAux]);
	//we want to output our dummy audio signal too for aural feedback
	Out.ar(0, Splay.ar(audioVal*0.2));
}).add;)

//instantiate an instance of the synth defined above
x = Synth(\testSine);

//set a super silly frequency
x.set(\frequency, 0.1);

//three useful debug methods:
~abus.getnSynchronous(2) //prints a list of the first n elements (2); synchronous
~abus.getnSynchronous(2)[1]  //prints 2nd element of the returned list of n elements; synchronous
~abus.get  //gets all the channels printed to the console

//we need this infinite loop/routine to send messages to TouchDesigner (as above)
(fork{
	inf.do{
		//we access the busses only once and store the 2 channels we know are populated into the variable (remember, it was defined at the beginning)
		~msg = ~abus.getnSynchronous(2);
		//send the two values as a bundled osc message
		~msg = ["/audioCoord1",~msg[0], "/audioCoord2",~msg[1]];
		~sendOSC.sendMsg(*~msg);
		//less waiting for a smoother feeling. The sine signal should "roll" the cube; the saw one should move it to the right through a "pulse-like" movement
	   0.01.wait;}
};)

s.quit;

TD-SC_Connection-Slave.toe (6.1 KB)