OSC Tag Type's

Hi Guys,
I have a question about OSC Output.
I have an application that accepts OSC In.
It takes various OSC Tag Types, such as F (32 bit float), I (integer), D (64 bit), and R (32 bit unsigned RGBA values).
Here are example of different OSC Tag Types:
i int32
f float32
s OSC-string
b OSC-blob
h 64 bit big-endian two’s complement integer
t OSC-timetag
d 64 bit (“double”) IEEE 754 floating point number
S alternate type represented as an OSC-string
c ASCII character
r 32 bit RGBA color
m 4 byte MIDI message
T True
F False
N Nil
I Infinitum

In TD when using the OSC Out CHOP I can only Send Tag Types F,D, & I.
I’m trying to find a way to send out Tag Type R but I’m having no luck.
I have a channel name (i.e. /composition/colorchange/colorpicker) and a value (i.e. 0x00FF00FF) to send.
The value such as the one listed above is a 32 bit unsigned integer known as a bitwise for sending RGBA color information.
0xRRGGBBAA so in the example listed above I would be sending a full green color.

Does anyone have experience in OSC Output when it comes to Tag Types? I’m basically wanting to create a few modifiers in TD that will break my color choice down in to RGB and those values will be merged together at the end to form the bitwise (0xRRGGBBAA) value to send.
But for now, I’m just trying to create the value using a table or text or constant setup and just push it out to my app.

I know very little Python and was hoping there would be a simple UI solution for me to play with, but if this does require Python. Would anyone be able to assist me on this, or at least point me to some materials or references that I could study so I could learn to achieve this?

Thanks for any help you guys could send my way. :blush:

“As a special case, you can send an OSC color value to color pickers.
OSC color values have the type tag r followed by an unsigned integer representing a 32 bit RGBA color. You can write a color as an int by bitshifting its RGBA values.”
fayewilliams.com/2011/09/21 … ba-values/

Here’s something I found on the OSC site:

Some OSC applications communicate among instances of themselves with additional, nonstandard argument types beyond those specified above. OSC applications are not required to recognize these types; an OSC application should discard any message whose OSC Type Tag String contains any unrecognized OSC Type Tags. An application that does use any additional argument types must encode them with the OSC Type Tags in this table:

OSC Type Tag Type of corresponding argument
h 64 bit big-endian two’s complement integer
t OSC-timetag
d 64 bit (“double”) IEEE 754 floating point number
S Alternate type represented as an OSC-string (for example, for systems that differentiate “symbols” from “strings”)
c an ascii character, sent as 32 bits
r 32 bit RGBA color
m 4 byte MIDI message. Bytes from MSB to LSB are: port id, status byte, data1, data2
T True. No bytes are allocated in the argument data.
F False. No bytes are allocated in the argument data.
N Nil. No bytes are allocated in the argument data.
I Infinitum. No bytes are allocated in the argument data.
[ Indicates the beginning of an array. The tags following are for data in the Array until a close brace tag is reached.
] Indicates the end of an array.

OSC Type Tags that must be used for certain nonstandard argument types

I see that TD can reconize Tag Type R from this page:
derivative.ca/wiki088/index … OSC_In_DAT

So my question would be:
How do I output Tag Type R?

Thanks guys :slight_smile:

I pulled that info from this site:
opensoundcontrol.org/spec-1_0

Hello.

Unfortunately there’s no builtin way to do this in TouchDesigner, but you could
instead of an OSC Out CHOP, use an UDP Out DAT and script your value:

Example:

n = op(‘n = op(’/project1/udpout1’)
n.sendBytes(‘/abcd’, 0, 0, 0, ‘,r’, 0, 0, 1,2,3,4)

where 1,2,3,4 are the r,g,b,a color values.

Note in this example my path is ‘/abcd’ however, you’ll need to pad this to a multiple of 4 bytes for the OSC format, so hence the 3 zeros for a length of 8.

Same with the ‘,r’ tag with the extra 2 zeroes.

We will look into adding Color as a supported option in our n.sendOSC() method in the next experimental.

Cheers,
Rob.

Phew… This is about greek to me haha.
Thank you so much for getting back with me. I will play around with this and see if I can figure something out.
How often does your experimental releases come out? (every few months, or even sooner than that?)

Would there be a way to add the R tag type to the OSC OUT CHOP in the future? And if so, what would be the best way to get a value such as 0x00ff00ff sent via a chop rather than a dat?

as far as the colors goes “1234” what type of value should I use? Hex?
Resolume is looking for a format such as 0x00ff00ff (0xRRGGBBAA)

so would an example be:

n = op(‘n = op(’/project1/udpout1’)
n.sendBytes(‘/abcd’, 0, 0, 0, ‘,r’, 0, 0, 00,ff,00,ff)

Thanks again for taking the time to help me out Rob. I really Appreciate it :slight_smile:

Hex is just another way of typing a number, so 0xff in Python is the same as 255 in python.

So your 4 color values can be written as a range betwee 0-255, or 0x00 - 0xFF, depending on if you want to work in base16 (hex) or base10 (normal decimal) numbering

Here is a toe someone created. I am able to get type R to come through.
If I replace the 1,2,3,4 at the end with a 0x00ff00ff i don’t get anything (i didn’t get the 1,2,3,4 either…)

Am I missing something? How do I get a value to come through while keeping the tag type r?

Sorry guys, I’m realllly new to this

dropbox.com/s/kuy9sj23o5zak … t.tox?dl=0

Hi Guys,
I was able to get an OSC Tag Type R to successfully send out, BUT, When I try to change the channel name to anything greater than 4 characters, it doesn’t work. (example: abcd works, 1234 works, but abcde or 12345 does not work).
Also, I could never get ANY value to send when using the Tag Type R. When I changed the tag type to F, I, or D I could get values to appear, but nothing when using Tag Type R (I tried using 1,2,3,4 or 0x00ff00ff or 00ff00ff or 123. Whatever format I tried, I couldn’t get any values to transmit via Tag Type R)
Any clues on how to do this?
Here is an example .tox to reference:
dropbox.com/s/w0u2720lbj626 … t.tox?dl=0

For now, I can output Tag Type F to 4 different OSC controls in Resolume (RGBA), But ideally It would be a lot cleaner if I could just output 1 value to the color picker using Tag Type R so the end users won’t have to setup 24 OSC addresses, rather, just setup 6 OSC addresses (for the 6 colors I’ll be sending out)

Does this make any sense?

Thanks again for any help you can send my way. I’m more of a CHOP user and not so much a DAT or Python coder, as a new language is hard for me to learn. I can build stuff within a UI but wrapping my head around any coding that’s harder than a op(‘example’)[‘example’] is going to take some time for me to learn haha.

Thanks guys and I hope you all have a great week :slight_smile:

Hello.

Since the script is creating the low-level OSC packet directly, you’ll have to follow the standard.
That is, all names need to be a multiple of 4 characters.

So for “/abcd” thats 5 characters, its needs another 3 to round up to 8:

‘/abcd’, 0, 0, 0

If you change the number of characters, you’ll have to follow it by 0,1,2 or 3 zeros accordingly.

As malcolm mentioned you can send your byte values in any notation you like.
Hex would look like:

n.sendBytes(‘/abcd’, 0, 0, 0, ’ ,r’, 0, 0, 0x00, 0xff, 0x00, 0xff).

Not sure what you mean by you “couldn’t get the values to transmit.”
How are you measuring it?
That makes me wonder if the receiving host doesn’t accept the non-standard r tag.
Can you monitor what it does receive?

Are you using upper or lower case r ?

Cheers,
Rob

The padding is exactly what was missing. I was using a OSC in dat/chop and without the padding all i got was the channel name and no value, with the padding the values came through

Thank you guys. I am up and running now. Resolume is successfully receiving tag type r and color changes. You guys rock! :slight_smile: