OSC Bundle syntax ??
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
Have you checked the OpenSoundControl object in the CNMAT Max distribution?
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 ?
… 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…
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…
----------begin_max5_patcher---------- 1110.3oc0YtsjaZCF.9Z6mBM9ZGWjDhC4tN8AnWzbWmNcDf10pCHnfnY2jIu 6UGvdIIliAiIyNqYr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RcFp9S0PiqCb5UxamRXSAo1w.zkI.ZYl6E7DIj.C7Wvpw.Q 5+lrx2T2YSibXXuC.3tkBY4GFxcbrxMs9gsADGXrxvG8TkMOiIAv27aXYzL8 5eMFU3oL9xd1bpCfW2oDVkjKnRtJRaqmQE2G7l9elmjvDss9y3IE4bgrQF5H l3TDIz.hj42CZEkIcS9s1tN3zpiogjH3pJQ5ejkQbxstXROT2A4j+5dx4MFQ x4q7Lu6xDdrxzJxIzlyDWOwhgwDdckowbzYX45YN4CGCmbWWNMpHAqr8zlyB GS1bhDzc6IRNiBSqqA9X74BC2bhD5GgRp27k8+Ov1+wa3 -----------end_max5_patcher-----------
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?
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…
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)
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.
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 :/
indeed that’s the function i would look for in max, but cannot find any info in the cnmat doc …
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)
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.