Forums > Dev

UDP/OSC message serialization format

July 19, 2011 | 6:25 pm

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?


July 20, 2011 | 9:31 am

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



Jan
July 20, 2011 | 2:53 pm

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

July 21, 2011 | 11:56 am

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


July 21, 2011 | 12:19 pm

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


July 21, 2011 | 2:08 pm

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.


July 21, 2011 | 2:12 pm

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…


July 21, 2011 | 2:36 pm

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. –

July 21, 2011 | 3:30 pm

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


July 22, 2011 | 3:16 pm

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.


July 22, 2011 | 3:39 pm

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.


October 20, 2013 | 1:21 pm

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?


April 23, 2014 | 11:15 pm

Hey Vektoren, I’m not able to open those pdfs you posted back in 2011. I’ve tried in both firefox and safari on a mac– has anybody been able to open these?


April 23, 2014 | 11:55 pm

I was able to save the pdf to the desk top, then open it with Preview.


April 24, 2014 | 12:22 am

strange, tried that, doesn’t work– do you mind emailing your pdf to me Rick?

terrymc at pacific dot net dot au


April 24, 2014 | 12:40 am

n.p. sent


Viewing 16 posts - 1 through 16 (of 16 total)