UDP from Max/MSP to Processing

    Jun 19 2013 | 10:50 am
    I'm trying to send MIDI from Max/MSP to Processing via udp. I have a number box with 0-127 values connected to udpsend. It is on the same port as the Processing patch, which uses the UDP library (http://ubaa.net/shared/processing/udp/)
    The problem is, at the Processing end I get this: receive: "int,i" from on port 57041
    I have no idea how to get an actual number value from this. It seems like it is receiving as 'i' instead of an actual number, or am I missing something fundamental? Trying to establish if this is a problem at the max end or at the Processing end.
    Bang messages are received like this: receive: "bang," from on port 57041
    Should integer messages not be received as "int,63" (etc.) ?
    Any help appreciated!

    • Jun 19 2013 | 1:33 pm
      In Processing I'm using the library 'oscP5' to receive data from Max via UDP without any problems.
    • Jun 19 2013 | 1:40 pm
      I tried it with oscP5 but I must be missing something with regards to receiving the messages... do you have to do anything other than send numbers to the udpsend object? How do you unparse the information in Processing?
    • Jun 19 2013 | 1:59 pm
      Hi, the reason is that udpsend is sending data in OSC format over UDP. If you just want to send integers in the range 0-127, you might be interested in the [sadam.udpSender] from The sadam Library (see https://cycling74.com/forums/announce-the-sadam-library-version-2012-10-08 ). I'd also recommend doing a forum search, as there are quite similar topics, eg:
      HTH, Ádám
    • Jun 19 2013 | 2:02 pm
      In Max you can simply send numbers to the udpsend object (but in general the OSC format requires a prepended address like "/mynumber").
      With oscP5 the receiver in Processing would be something like this
      void oscEvent(OscMessage theOscMessage) { println("addr: "+theOscMessage.addrPattern()); println("type: "+theOscMessage.typetag()); println("args: "+theOscMessage.get(0).intValue()); }
      See also example 'oscP5sendReceive' from the library.
    • Jun 19 2013 | 2:25 pm
      Thanks, got it working now. I was missing the bits for getting the argument at the Processing end:
      Also the stuff about prepending in Max is useful to know. In the meantime I figured out getting MIDI directly into Processing so now I have both options. :-)