TouchDesigner with Sonic Pi?

Has anyone tried hooking up TouchDesigner to generate visuals from OSC messages from SP?

Just read about deadmau5’s new tour, and he’s using TD for generating visuals on the fly with his Cube v3. A video is worth a thousand words, so here.

The dude is a coder, and I love the possibilities I’m seeing here. Just wondered if anyone here has played with TD?

1 Like

did you got it? i just start to look at it, but until now i was not able to make one software comunicate with the other.

Welcome to the community. No, I never did. I’m investigating Max/MSP right now, which is similar – connecting objects with cables, etc.

1 Like

so, i got it to work. if you still need some help, i´ll be glad to do it.

1 Like

@pablo_pablo - if you have some spare time it would be wonderfully useful if you shared how you got Sonic Pi talking to TouchDesigner here in the forums. Was it via OSC or MIDI?

2 Likes

Hi, @samaaron! It was via OSC.

Here is a very simple example how it can be done:

  1. a) the adress i use is “localhost”, and port 10000.

b) then just give it a name and a value for each sign you want to send to touchDesigner. here in the example a have two signs, and i gave the name “/interactive/box1” and “/interactive/box2”. You can name it as you wish and put value you need.

  1. then, in touchDesigner, you must have a OSC Chop to receive the sign from Sonic Pi, and fill the correct port and adress.

  1. you must have a Select Chop for each sign you are sending from Sonic Pi, and name each channel as we did in Sonic Pi also. So, in this case, we need two Select Chops.

  1. now you can just drag these values in the variables you want. In this case, i just used rotateX and rotateY, to rotate the box. You may want to put a Lag Chop after the Select Chop to make the movements soften.

Thats it! I hope this might help.
Cheers!

5 Likes

Thank you Pablo! this was very helpful for me.

When running the code in Sonic Pi, I’m not seeing any feedback in the oscin1 viewer or in the select CHOP’s, but in the screenshot @pablo_pablo posted above, it looks like the viewers should show the incoming OSC from SPI. My local address and network port settings look correct to me. Is there some reason that SPI’s OSC messages aren’t getting to TouchDesigner?

Where do you drag values from? I can only see how to drag a channel name.

I’ve got it working, and I’m adding this separate reply because the methods of communication between SPI and TD aren’t obvious.

To drag values from a CHOP to variables in TD, you activate the CHOP’s viewer by clicking the little plus-sign flag in its lower right corner. Mousing over the chop then turns the cursor to a caret. Drag this caret on top of the node you want to control, and the caret turns into an arrow, then the target nodes data viewer appears in the upper right. Now drag the arrow cursor over to the data view and drop it on top of the variable you want to control. A menu will appear, and your best choice until you know better is “Export CHOP.”

SPI’s osc works fine, just make sure that your channel names are correct. Since the names are strings, you need quotes around them in SPI, and also a stroke character, which apparently doesn’t get displayed in TD.

MIDI also works fine, the difference from OSC being that MIDI doesn’t have named channels, and the data via MIDI is restricted to 0-127, being communicated by the velocity parameter.

Here are the notes I made for myself:

MIDI into TD on MacOS

To add an IAC bus where SPI will send the MIDI, do:

  1. Dialogs > MIDI Device Mapper > Create New Mapping
  2. select an IAC Driver Bus from the dropdown under “In Device”

CHOPS required: MIDI In ==> Select ==> Math ==> [your target]
Comments I’ve seen refer to putting a Null CHOP between the Select and Math, but it seems to work without that, so I don’t yet know what functionality a Null provides.

The MIDI In CHOP will receive all the MIDI coming in from all the In Devices in the MIDI Device Mapper, so you need the Select to grab what you want to direct to your target. I.e., you have one MIDI In and many Selects.

The MIDI note–actually, the note/channel combination–is effectively a channel in TouchDesigner, e.g. “ch1n61” is a Channel Name in a Select. For convenience, a list of channel names that the Select CHOP has already received accumulates in the Select’s dropdown at Channel Names in the Select’s Select tab. You can also manually enter channel names.

MIDI velocity is the data to send to your target, and is only ever in the range 0-1 in increments of 1/128. You need a
Math CHOP to scale the data per your target’s requirements.

BEWARE: TouchDesigner adds 1 to the MIDI note number.

2 Likes

@blipson Excellent, thank you for documenting this.

The midi offset is common. Some manufacturers prefer 0-127 and others 1-128 and can cause headaches.

Much appreciated.
Hussein