Forums > MaxMSP

OSC Bundle syntax ??


tep
March 19, 2011 | 10:41 am

I’m trying to "speak" to a Arduino board. To observe the validity of my OSC packets, i use the oscP5sendReceive.pde script in Processing.

To avoid long and fastidious script in Arduino itself, i have to send an OSC bundle, since the messages i’m sending are quite long ones (between 100 and 1000 messages at 25 messages/second). So that the arduino board gets an array, and not a loooooong list of values.

So i am currently trying to find out how to write this bundle, but the infos about OSC "syntax" are not clear, and no example is given on cnmat examples or wherever. Seems like few are interested by sending BIG lists in OSC.

I understood that the bundle must be composed like this : #bundle – timetag – size of bundle – bundle elements

… But how to actually WRITE it ? i can’t find out in which order, where to put the tag, which separators, or anything…. Please help me, much thanks


March 19, 2011 | 11:13 am

Have you checked the OpenSoundControl object in the CNMAT Max distribution?



tep
March 19, 2011 | 12:02 pm

Sure I did. My question is about the message … The OSC bundle description is a bit laconic in the OpenSoundControl external help file .

Any idea ?



tep
March 20, 2011 | 2:11 pm

… Seems not very inspiring to you people.

I’ll try to be more explicit :
- I’m sending a big list (1000 items) at a 25fps rate. This list can be divided into 10×100 values (0-255)
- I would like Processing/Arduino to receive an ARRAY and not this huge LIST, so that it avoids the OSC receiver (Processing/arduino/whatever) to look for each value, but just get one array.

In the OpenSoundControl help file, there’s very few explanation about how to write correctly a bundle. The "openbundle" or [ and "closebundle" or ] have arbirtary result, as it does exactly the same as just sending a BANG to the OpenSoundControl external.

I wish Processing could see the beginning and end of an array … Like specified here : http://opensoundcontrol.org/spec-1_0

Moreover, can’t see how to send more than about 300 values to OSC, even when increasing the buffer.

A bit fuzzy…


March 21, 2011 | 2:02 am

There do appear to be shortcomings in the documentation – on the other hand, the sub (and related) patches do have a lot of info in them. Some may be of use. My understanding is that a bundle is any collection of OSC style messages with a time tag – the bundle does not need to be explicitly defined -unless you are making a "sub"-bundle – the OpenSoundControl object takes care of that as well as the packet size. (Check the subpatch "timestamped-bundle-generation of Osc-timetag help) . Use verbose mode in OpenSoundControl (debug) to check what is going on – it will be very useful to give you an idea – especially of the buffer size of the current buffer…

– Pasted Max Patch, click to expand. –

March 21, 2011 | 8:56 am

If you’re on a UNIX machine, you can try investigating packets using the ‘nc’ command (in the terminal).

‘nc -lu 7400′ will listen on port 7400.

Oddly floats show up as "‘Ap", but when you wrap a float in brackets (i.e. [5.0]), it appears as a float (type tagged "s"). Does anybody know why that is?



tep
March 21, 2011 | 7:13 pm

Thank you Spectro, indeed i check all the documentation. It’s not that i cannot send simple OSC message – i succeed in sending basic messages – …. But, as Morgan specifies, a float or a group of floats or ints, when surrounded by brackets, become OSC-strings… Where i’d like them to appear as array, with [ and ] expliciting the beginning and end of the array itself.

So it seems we don’t write it correctly…


March 22, 2011 | 9:31 am

Why can’t you just construct OSC packets like so?

/osc/packet 1.0 2.0 3.0 4.0 etc. ?

In my work when I want to send an array, that’s how I do it, though I’m staying in Max and udpsend/receive have no problems understanding eachother.

btw, ‘nc -luv 7400′ is nicer (-v flag prints more info about the packet)


March 22, 2011 | 2:06 pm

With OSC I thought you only had the option of float, int or string, but I may be wrong.

I turn OSC strings into an array in Arduino with the ‘toCharArray’ function, but then I’m only sending a few values at once.



tep
March 22, 2011 | 2:12 pm

Sorry, i’ll be redundant …

I can construct simple osc packets. But as i need to send them at a great frequency, it makes A LOT of data to send : 100 x 10 values every 25 fps. I’d prefer to send real arrays, and not lists……

oh i’m repeating myself a lot :/



tep
March 22, 2011 | 2:20 pm

Hi Luke,
indeed that’s the function i would look for in max, but cannot find any info in the cnmat doc …


March 22, 2011 | 2:35 pm

So just to be clear…

you want to turn your values into an array in Max BEFORE you send over OSC to your Arduino rather than turn the string into an array the other end??

Would that be possible? As I understood it you would only be able to use strings with OSC (or floats, or ints obviously)



tep
March 23, 2011 | 12:21 pm

Indeed Luke, that’s what i was hoping to do. Finally we’ll manage, as you said previously, to turn the lists into arrays into Arduino.

I thought this process could ‘save’ bytes during the communication… But it seems to work for the moment, even at high frequency.

Thanks


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