Control NeoPixels through TouchDesigner

Hi All,

I’m working with an x-OSC board linked to a neo pixel ring for an installation.

I’m trying to light up the neopixels with data from touch
(x-osc does this with openframeworks) link here: x-io.co.uk/neopixel-led-screen-u … ith-x-osc/

My understanding is that I must create a text DAT and oscOut DAT and format a message in the text DAT using op(‘text1’).sendosc() in the text DAT.

I am trying to send an osc blob using this format. Is it at all possible to send multiple colors to the neopixels by converting a ramp TOP to DAT?

Thanks!

Hi kprasad1221,

You can send data over OSC with either CHOPs or DATs. Here’s a quick look at what that looks like:

base_dat_osc_example.tox (926 Bytes)
base_chop_osc_example.tox (1.37 KB)

Depending on what you’re up to, the CHOP may be more efficient than the DAT approach.

hi raganmd,

thanks for your help! the example tox are able to communicate with and turn on the LED ring, but i am still unable to control the led emission color and intensity in a predictable way.

I believe this is because the oscOut CHOP does not support sending OSC Blob formatted messages.

I have found an example python snippet for formatting osc messages as blobs. Is it possible to create a custom python object in Touch for converting OSC data into blob format?

code pasted below:

“”“Convert a string into an OSC Blob.
An OSC-Blob is a binary encoded block of data, prepended by a ‘size’ (int32).
The size is always a mutiple of 4 bytes.
The blob ends with 0 to 3 zero-bytes (‘\x00’)
“””

if type(next) in types.StringTypes:
OSCblobLength = math.ceil((len(next)) / 4.0) * 4
binary = struct.pack(“>i%ds” % (OSCblobLength), OSCblobLength, next)
else:
binary = “”

return binary

(found at pydoc.net/pyOSC/0.3.5b-5294/OSC/)

An update:

using the following page as a guide matthewragan.com/2015/07/03/tou … pressions/

I created a text DAT named oscMessageClass and pasted the pyOSC library into it.

I then connected a TOPto CHOP, which reads in color values determined by a Constant TOP, to an Expression CHOP.

The expression CHOP has the expression me.mod.oscMessageClass.OSCString(next) for each channel of data to be converted to a blob.

I receive the following error (shown in the attached image file - the line of code with the error is in the bottom right screen in the image)

Is the issue with the way the data is formatted in the CHOPs? is that information different than what the python code is expecting? if so, is there a way to convert CHOP data to a format the OSCString function can interpret, or should I try to create a chopto DAT connected to an eval DAT instead?

Thank you for all your help!

Hi kprasad1221,

Can you share the project file? It can be difficult to help debug a problem just looking at screen shots. :slight_smile:

Hi kprasad1221,

Did you manage to make this work? We are trying to do a similar thing using touch designer to communicate with LEDs using an xosc. How did you get the osc Blob output from rgb values?