Converter for OSC message formatting

Andy Maskell's icon

Below is a snapshot of part of a routine that I have written to send and receive OSC commands between Max and a remote client. It happens to be a Behringer mixer but that aspect is not important to this question:

I would like to get rid of the Max [udpreceive] object altogether as it is causing conflicts with the other software that I interface to (Mixing Station) and is well know for causing problems with Behringer equipment.

I could simply use the output of the [sadam.udpClient] object on its own but the formats of the messages returned by that and [udpreceive] are different.

[udpsend] transmits and [udpreceive] returns OSC messages in a decoded format that can be used directly in Max, that being the OSC address followed by all the subsequent data values separated by spaces. These messages can be constructed and broken down easily in Max using simple objects such as [join], [combine], [sprintf], [unjoin], etc.

The Sadam objects, on the other hand, use raw OSC blob messages for both send and receive that follow the format:

/address/.../... 0 0 ,xxxxx 0 0 data1 0 0 data2 0 0 data3 0 0 .............. 0 0 data n

where xxxxx indicates a bundle of type identifiers for each data blob, such as {s} for symbol, {f} for float, {i} for integer, etc. - these bundles can be of arbitrary length and include multiple data types. (Note the comma that preceedes this list.)

Each of the data blobs can also be of arbitrary lengths depending on their type, so symbols can be any length in a UTF-8 ASCII format, integers are 4 byte 32-bit signed or unsigned integers, floats are usually signed 4 byte 32-bit values, etc.

They are all seperated by pairs of null bytes ("0 0") that Max really makes heavy weather of!

The only way that I can find so far to convert the formats is to link corresponding Max and Sadam objects via the internal loopback "localhost" (or 127.0.0.1).

There is nothing that I can find (such as in the Sadam, odot or CNMET libraries or via Google searches) that would allow me to convert between the Sadam format and the Max one without me writing my own encoder and decoder, which is obviously possible but, equally, complicated. There's no point in me consuming time on this if there is already a solution out there!

Does anybody know of a library, package or external object/objects that can perform these functions?

Matt Gorbet's icon

Did you ever get a response to this? I'm looking at doing the same thing, and it seems odd that nobody has done this?

Andy Maskell's icon

Nope! I'm still using the method that I posted originally. It works fine now that I have used random port numbers for the [udpsend] and [udpreceive] objects. I'm actually interfaced to four mixers simultaneously (X32 and three XR18) using this method, with no conflicts or packet loss.