Forums > MaxMSP

Max to processing via OSC?

January 23, 2012 | 8:32 pm

Hi,

I am trying to send an integer message from Max through OSC to processing and was wondering if this is something anyone has any experience with?

I have built a simple OSC send patch in Max but am unsure how to parse the messages effectively using processing. I would like the integer value so i can assign it to something like a co-ordinate in my processing patch.

I know its more regarding the processing side of things than the Max, but thought someone might have some experience with this?

Any help would be fantastic

Cheers

[attachment=183071,3240]

Attachments:
  1. osccomm.jpg

January 23, 2012 | 8:42 pm

I normally do this with udpsend and oscroute

Joe


January 23, 2012 | 9:01 pm

Hi thanks for the quick reply, I was gonna go into a bit more detail but uploading the picture automatically posted it :/

I have literally just downloaded Processing and done a few of the tutorials today.

I’ve done a little really basic C++ but no Java so am not really sure of the syntax differences. I have an idea that I want to:

1.declare a variable

2.assign an integer value to the variable from the OSC packet

3.use the variable in the coordinate for a shape or something..

Do you know of/have any examples using either of these objects and any advice on parsing the OSC packet on the Processing side?

Many thanks


January 23, 2012 | 9:16 pm

If you have familiarity with C++, you’re probably better off working with openFrameworks (http://www.openframeworks.cc/) than Processing since oF is based on C++.


January 23, 2012 | 9:22 pm

jonathanb: Thanks for tuning me into of, I’ll hafta take a look at it again… I saw it a while while ago.

seanzshow: I wish I could give you more detail but processing doesnt like my system. If processing is on the receiving end it seems like most of the heavy lifting will be done there. OSC is composed of ascii plaintext. Even if the messages coming out of max are malformed you should still be able to parse them as strings.


January 23, 2012 | 9:34 pm

jonathanb: Thanks for tuning me into of, I’ll hafta take a look at it again… I saw it a while while ago.

seanzshow: I wish I could give you more detail but processing doesnt like my system. If processing is on the receiving end it seems like most of the heavy lifting will be done there. OSC is composed of ascii plaintext. Even if the messages coming out of max are malformed you should still be able to parse them as strings.


January 24, 2012 | 10:15 am

@seanzshow I’m not sure what the [OpenSoundControl] object is doing here (wasn’t that part of the original CNMAT tool set?); [udpsend] can format and transmit OSC messages on its own.


January 24, 2012 | 8:46 pm

nick rothwell: Is oscroute also no longer useful?


January 24, 2012 | 8:58 pm

OSC-route is actually still useful. If you have a message /1/foo/bob OSC-route for /1 would return /foo/bob whereas a normal route for /1 wouldn’t as it only works on the exact phrase (so you’d have to do a route on /1/foo/bob to get that message).


January 24, 2012 | 11:56 pm

1) If you’re using the [OpenSoundControl] object to format your messages, then updsend needs a third argument that is a string. Like [updsend 12345 CNMAT]. Check the CNMAT Compatibility tab in the help file.

2) it seems like you have the OSC address parsed correctly. theOscMessage.arguments should give you the arguments to your address. Parsing individual arguments looks like:

int firstValue = theOscMessage.get(0).intValue();
float secondValue = theOscMessage.get(1).floatValue();
String thirdValue = theOscMessage.get(2).stringValue();

I took that from oscP5parsing.pde, which came with the oscP5 library.

mz


January 25, 2012 | 1:24 am

Hi,

Yea, I've been going through the examples from oscP5 but Im still a little confused Im afraid. Im trying to just get the integer from the OSC argument to assign to a variable in Processing. Here is as far as I've got…

As you can see from the bottom of the processing sketch, I can print the message that OSC has been received, and the type tag. But not the actual Integer, which I believe is stored in the variable firstValue? I've tried prinln (firstValue); at various points but cannot get any numbers out at all.

Any help would be greatly appreciated.

Cheers

[attachment=183247,3247]

Attachments:
  1. osccomm.jpg

January 25, 2012 | 3:33 am

This thread might be useful.

http://cycling74.com/forums/topic.php?id=27070


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