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?

#58097
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 :)

#208621
Jul 20, 2011 at 2:53pm

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

Best jan

Attachments:
  1. 2387.webtomax.zip
#208622
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:

http://cycling74.com/download/Share/AdamSiska/sadamLib_2010-12-07.zip

Hope this helps,
Ádám

#208623
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 ;)

#208624
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.

#208625
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…

#208626
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. –
#208627
Jul 21, 2011 at 3:30pm

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

#208628
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.

#208629
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.

#208630
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?

#268537

You must be logged in to reply to this topic.