Forums > MaxMSP

resolume / OSC parsing nightmare

May 22 2012 | 9:20 pm

trying to deal with getting a single piece of information out of resolume arena’s completely insane OSC implementation.

basically, when you start a video you get, for example:

/layer5/clip3/connect 1

is there a simple way to match that exact string, and just pass the 5 and 3 through as ints? my solution right now is complete garbage and requires far too much OSC filtering, but i wasn’t sure where to start really:

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

any help is appreciated!


May 22 2012 | 10:46 pm

This is an expr problem. If max regexp documentation is not to your taste there is extensive documentation in teh interwebz. Be aware that max expr may have unique features/lack thereof.

May 22 2012 | 11:14 pm

… this is why i shouldn’t have posted code.

expr has nothing to do with what i’m asking about.

filtering the OSC messages down to one that i want is the problem, i want to do that long before i hit expr

May 23 2012 | 2:06 am

Expr will do what you want

Either find a way to select numbers or simply count the number of symbols from the left up to the one you need and grab it.

PS – didnt even look at the patch

May 23 2012 | 2:25 am

If by chance all of the OSC you are receiving is formatted like the above, then you might try using regexp to replace for example layer5/ by layer/5/, then do to the usual replacement of / by single space before using route to parse the OSC. In other words, change the input string so that the numbers look like an OSC address component rather than a suffix on an identifier. Something like "regexp ([0-9]*)/ @substitute /%1/" — but I probably have the syntax wrong — before the usual regexp / @substitute " ", then "route layer" "route 1 2 3 4 5" etc. to parse the OSC. Hope that makes sense.


May 23 2012 | 2:57 am

I was going to suggest CNMAT’s OSC-route would be useful to you till I saw you were ‘using’ it. Didn’t actually register the *real*problem here

May 23 2012 | 3:09 am

I think we must question the statement "any help is appreciated!". No offense…

May 23 2012 | 3:42 am

This seems to get most of what you need via regexp. Anything more than cursory testing not included.

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

May 23 2012 | 9:57 am

Or just use a single regexp like this.

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

May 23 2012 | 2:03 pm

broc, that’s the jam. thank you.

spectro: yours works until you get to high layers, anything with 2 digits and they start to run together.

jamesson: expr only deals with numbers that i can tell… so FYI when i first read "this is an expr problem", it had already been giving me errors when getting fed strings of letters from other stray osc messages. so it actaully WAS a problem.

sorry for not being smart and having to be frustrated and struggle through code, i guess you never went through that.

May 23 2012 | 3:25 pm

I did get frustrated and struggle, and you can see that on this very forum :). However, I did not complain about answers I did not like :).

That said, I humbly apologize to you and everybody for confusing expr and regexp. That was a pretty big booboo.

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

Forums > MaxMSP