Forums > MaxMSP

UDP from Max/MSP to Processing

June 19, 2013 | 3: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 127.0.0.1 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 127.0.0.1 on port 57041

Should integer messages not be received as "int,63" (etc.) ?

Any help appreciated!


June 19, 2013 | 6:33 am

In Processing I’m using the library ‘oscP5′ to receive data from Max via UDP without any problems.


June 19, 2013 | 6:40 am

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?


June 19, 2013 | 6:59 am

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 http://cycling74.com/forums/topic/announce-the-sadam-library-version-2012-10-08 ). I’d also recommend doing a forum search, as there are quite similar topics, eg:

http://cycling74.com/forums/topic/midi-via-udp-max-data-types

http://cycling74.com/forums/topic/best-way-to-receive-udp-data-form-sensors

http://cycling74.com/forums/topic/udposc-message-serialization-format

etc.

HTH,
Ádám


June 19, 2013 | 7:02 am

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.


June 19, 2013 | 7:25 am

Thanks, got it working now. I was missing the bits for getting the argument at the Processing end:

theOscMessage.get(0).intValue();

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


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