Max to processing via OSC?

Jan 23, 2012 at 8:32pm

Max to processing via OSC?

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
#61410
Jan 23, 2012 at 8:42pm

I normally do this with udpsend and oscroute

Joe

#221505
Jan 23, 2012 at 9:01pm

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

#221506
Jan 23, 2012 at 9:16pm

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

#221507
Jan 23, 2012 at 9:22pm

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.

#221508
Jan 23, 2012 at 9:34pm

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.

#221509
Jan 24, 2012 at 10:15am

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

#221510
Jan 24, 2012 at 8:46pm

nick rothwell: Is oscroute also no longer useful?

#221511
Jan 24, 2012 at 8:58pm

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

#221512
Jan 24, 2012 at 11:56pm

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

#221513
Jan 25, 2012 at 1:24am

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
#221514
Jan 25, 2012 at 3:33am

This thread might be useful.

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

#221515

You must be logged in to reply to this topic.