Forums > MaxMSP

Problem with OSC

December 6, 2006 | 12:53 pm

I am having difficulty parsing OSC messages I send with FLOSC in Max. I can print them from udpreceive perfectly, but it seems impossible to use that data that comes directly.

Therefore I tried to use the opensourcecontrol object but when I link the udpreceiver to the opensoundcontrol, no data comes from any of the outputs (checked with print).

Any ideas as to what could cause this problem?


December 6, 2006 | 3:43 pm

Quote: datadigit wrote on Wed, 06 December 2006 13:53
—————————————————-
> I am having difficulty parsing OSC messages I send with FLOSC in Max. I can print them from udpreceive perfectly, but it seems impossible to use that data that comes directly.
>
> Therefore I tried to use the opensourcecontrol object but when I link the udpreceiver to the opensoundcontrol, no data comes from any of the outputs (checked with print).
>
> Any ideas as to what could cause this problem?

Check out the cnmat_compatibility subpatcher in the udpreceive help file. The OpenSoundControl object needs the udpreceive to have the CNMAT flag to understand its output. I believe flosc outputs cnmat compatible osc.

http://avdl1064.oli.tudelft.nl/WFS/

I made this some time ago with (a customized version of) flosc. The source of the flash file is downloadable on that page.

Cheers,
Mattijs


December 6, 2006 | 9:53 pm

On 6-dec-2006, at 16:43, Mattijs Kneppers wrote:

>
> Quote: datadigit wrote on Wed, 06 December 2006 13:53
> —————————————————-
>> I am having difficulty parsing OSC messages I send with FLOSC in
>> Max. I can print them from udpreceive perfectly, but it seems
>> impossible to use that data that comes directly.
>>
>> Therefore I tried to use the opensourcecontrol object but when I
>> link the udpreceiver to the opensoundcontrol, no data comes from
>> any of the outputs (checked with print).
>>
>> Any ideas as to what could cause this problem?
>
> Check out the cnmat_compatibility subpatcher in the udpreceive help
> file. The OpenSoundControl object needs the udpreceive to have the
> CNMAT flag to understand its output. I believe flosc outputs cnmat
> compatible osc.
>
> http://avdl1064.oli.tudelft.nl/WFS/
>
> I made this some time ago with (a customized version of) flosc. The
> source of the flash file is downloadable on that page.
>
> Cheers,
> Mattijs

The phrase "CNMAT compatible OSC" is a bit misleading here.
There is only one kind of OSC: the one originally developed and still
researched at CNMAT.
Then why is there a CNMAT flag?

the updrecieve object is capable of parsing OSC packets into max
messages all by itself.
this is what it does by default.
It is limited to a subset of the full OSC protocol. It does not do
bundels within bundles
for example. Most people do not use this.

The OpenSoundControl object is also capable of parsing OSC packets,
and has a more complete implementation.
The OpenSoundControl object expects as its input a pointer to the
unprocessed packet as it
was received over ethernet. This is what the original otudp object
passed to it.
this packet is called a FullPacket.

Now that otudp is deprecated and replaced by udpreceive, the CNMAT
flag tells udpreceive
to act like otudp did: output a pointer to the unprocessed packet.

in fact, "CNMAT flag" is a bit misleading too.
if updrececeive has a 3rd argument, it enters "pass FullPacket" mode.
you might as well use FullPacket or otudpcompatibilitymode or 42 as
the 3rd argument,
whichever you find more selfexplanatory.

HtH
-jennek


December 7, 2006 | 10:16 am

Maybe I’m thinking in the wrong directing, focusing on the OSC message here.

This is the Patcher that demonstrates my problem. The Max output I get when sending a OSC packet is this:

*error: number: doesn’t understand "234"
prcMsg: 234
raw: /sc/post 234

I want to use that number 234, but it is not recognized as Max data.

max v2;
#N vpatcher 214 78 594 622;
#P window setfont "Sans Serif" 9.;
#P window linecount 1;
#P newex 125 328 59 9109513 print prcMsg;
#P newex 59 228 43 9109513 print raw;
#P number 224 331 35 9 0 0 0 139 0 0 0 221 221 221 222 222 222 0 0 0;
#P newex 142 253 71 9109513 osc-route /post;
#P newex 142 222 63 9109513 osc-route /sc;
#P newex 107 122 81 9109513 opensoundcontrol;
#P newex 94 80 112 9109513 udpreceive 7374 CNMAT;
#P connect 0 0 5 0;
#P connect 0 0 1 0;
#P connect 3 0 6 0;
#P connect 1 1 2 0;
#P connect 2 0 3 0;
#P connect 3 0 4 0;
#P pop;


December 7, 2006 | 11:36 am

Ah, posting a patch is always good practice.

Could it be that the int is parsed as a symbol so that the numbox doesn’t recognize it? Perhaps in flash you need to add an int explicitly as an int and not as a symbol or string. Have a look at the patch below. This works here. Does it work for you? What does the prepend set output say when you receive the message from flosc?

Mattijs

#P window setfont "Sans Serif" 9.;
#P window linecount 1;
#P message 218 189 50 196617 234;
#P newex 218 170 62 196617 prepend set;
#P message 19 35 72 196617 /sc/post 234;
#P newex 19 54 120 196617 udpsend 127.0.0.1 1111;
#P newex 142 189 73 196617 print prcMsg;
#P newex 117 108 57 196617 print raw;
#P number 104 189 35 9 0 0 0 3 0 0 0 221 221 221 222 222 222 0 0 0;
#P newex 104 148 90 196617 osc-route /post;
#P newex 104 128 77 196617 osc-route /sc;
#P newex 19 108 95 196617 opensoundcontrol;
#P newex 19 79 122 196617 udpreceive 1111 CNMAT;
#P connect 3 0 4 0;
#P connect 3 0 6 0;
#P connect 3 0 9 0;
#P connect 0 0 1 0;
#P connect 0 0 5 0;
#P connect 9 0 10 0;
#P connect 8 0 7 0;
#P connect 1 1 2 0;
#P connect 2 0 3 0;
#P window clipboard copycount 11;


December 7, 2006 | 8:48 pm

Quote: datadigit wrote on Wed, 06 December 2006 04:53
—————————————————-
> I am having difficulty parsing OSC messages I send with FLOSC in Max. I can print them from udpreceive perfectly, but it seems impossible to use that data that comes directly.

Both of the patches posted in this thread work fine for me. CNMAT’s "printit" object is also a handy way to debug some of these problems, it tells you if a message is a symbol or an int or something else.

It would help to know what platform you are running, etc. I haven’t had any confirmed reports of problems with the Max implementation of OSC, so I start to suspect flosc…

mz


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