UDP/OSC message serialization format

Jul 19, 2011 at 6:25pm

UDP/OSC message serialization format

udpsend serializes Max messages into an “OSC compatible UDP packet”. I’d like to try to do the same from an external program; i.e., I want to send commands to Max via UDP via a program I create myself. I’m guessing this has been done before, but are there any publicly-available examples or documentation for doing this?

Jul 20, 2011 at 9:31am

Thats funny, because I tryed the same yesterday :) I wrote a little C# program with Visual Studio Professional… but I can’t send any message that Max understand. I tryed many OSC examples but no one works :(

If I found an solution, I will add that information here :)

Jul 20, 2011 at 2:53pm

Hi, maybe this helps: Andy Schmeder wrote a PHP librabry that can fromat and send UDP/OSC data.
And attached is a short code example in php how i send udp/osc from a server/website to max.

Best jan

  1. 2387.webtomax.zip
Jul 21, 2011 at 11:56am

If you do NOT need OSC, just pure UDP send/receive, you could try [sadam.udpSender] and [sadam.udpReceiver] from the sadam Library:


Hope this helps,

Jul 21, 2011 at 12:19pm

Okay, thanks to Jan I found a solution :) Thank you. I have to test a little bit around and write then a little how-to => I attach the how-to here ;)

Jul 21, 2011 at 2:08pm

I’ve been playing around with the official OSC tools a little bit, and it seems like udpreceive can receive strings sent by the command-line sendOSC utility. I’ve tried doing the equivalent in custom code using the C OSC client library (OSC-client.h), but I haven’t had time to resolve some formatting errors I get when I send messages this way.

In any case, even if that succeeds, I’d still like to know how Max serializes its data into OSC messages. If I’m not able to figure that out, then another option would be to write a parser in Max that takes string data from OSC messages and translates them into some action or data structure that is native to Max.

Jul 21, 2011 at 2:12pm

Give me some time, jeffomatic. I think my howto would help you to do the job without any OSC lib. I hope that I find time to finish that document in the next days…

Jul 21, 2011 at 2:36pm

Okay, here is version 1. In the next version I want to describe howto send numbers. Version 1 covers just text messages :) With this information you are able to communicate with Max from any programming language that can send byte arrays over UDP :)

Here my Max code to receive:

– Pasted Max Patch, click to expand. –
Jul 21, 2011 at 3:30pm

Version 2: I added an UML diagram for building a text message :)

Jul 22, 2011 at 3:16pm

Here we are: Version 3 :) I added the information how to send numbers (integers and also floats) to Max. In chapter 3 I provide a quick and dirty implementation with Microsoft C# 4.0 to show how to do that :)

Have fun!

Next goal: How to receive messages and numbers from Max MSP.

Jul 22, 2011 at 3:39pm

Max’s UDP objects support pretty standard, if simple, OSC. There are a few Java OSC libraries out there (which makes them usable from Python, Clojure, Ruby and so on) – I’ve written one and Mattjis Kneppers has just implemented one.

Oct 20, 2013 at 1:21pm

Just wanted to say that I found this helpful when putting together an external UDP connection to Max. Thanks!

What is the scoop on addresses? It seems that when sending to Max, the address just comes through as part of the message (prepended to the list). Is the intent to use this on a [route] object or something?


You must be logged in to reply to this topic.