Forums > MaxMSP

Split osc message and send it away

June 3, 2014 | 1:12 pm

Im sending messages over as a single string with osc.

It looks like this:
"nx:0.33 ny:0.21614583 l:0.4453125"

I would like to get the data out of it but so far i have no luck. Either nothing happens, or i get "no such object" or it sends almost the whole string instead of one part.

I don’t want the order to matter so instead of "nx: ny:" it should also be possible to use "ny: nx:". Why else use indices.

Could someone help?
This is what i have so far:

– Pasted Max Patch, click to expand. –

June 3, 2014 | 4:44 pm

This sounds like a bad OSC namespace to me. But, if you’re stuck with it then this might help:

– Pasted Max Patch, click to expand. –

June 3, 2014 | 10:40 pm

I agree with MZED, the OSC addresses don’t look right to me. I would expect something more like "/nx 0.33".

If you can change the source messages to conform with the normal OSC structure you can use [OSC-route] external which is available here: http://cnmat.berkeley.edu/downloads

If you are stuck with the message you posted this will work:

– Pasted Max Patch, click to expand. –

June 4, 2014 | 5:17 pm

This is more compact:

– Pasted Max Patch, click to expand. –

June 7, 2014 | 2:16 pm

Thanks for all the help so far.

I fixed the OSC namespace, now the message gets sended like this:
/ny 0.317708 /l 0.082031

How can i route that? Do i need to substitute that as well?
I guess normally you would send it as separate messages but in my case that won’t make it easier.
I’m sending data over of multiple objects which could add up to around 200 objects (later i will send the id).

– Pasted Max Patch, click to expand. –
– Pasted Max Patch, click to expand. –

June 7, 2014 | 4:29 pm

You need to combine elements of both of the patches you’ve posted. The [zl iter 2] object breaks up a long message into a number of messages each with two elements. So in your case, you end up with a bunch of messages which include "osc-address osc-value". This is the sort of message that you can pump through the [OSC-route] object.

– Pasted Max Patch, click to expand. –
  • This reply was modified 3 months by  nosulliv.

June 7, 2014 | 4:55 pm

Thanks. I almost had that. I only had a regexp : @substitute / inbetween that made it not working.
Now i can finally produce sound!! wheeew :)


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