resolume / OSC parsing nightmare

May 22, 2012 at 9:20pm

resolume / OSC parsing nightmare

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!

-a

#62395
May 22, 2012 at 10:46pm

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.

#225372
May 22, 2012 at 11:14pm

… 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

#225373
May 23, 2012 at 2:06am

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

#225374
May 23, 2012 at 2:25am

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.

-Luddy

#225375
May 23, 2012 at 2:57am

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

#225376
May 23, 2012 at 3:09am

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

#225377
May 23, 2012 at 3:42am

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

– Pasted Max Patch, click to expand. –
#225378
May 23, 2012 at 9:57am

Or just use a single regexp like this.

– Pasted Max Patch, click to expand. –
#225379
May 23, 2012 at 2:03pm

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.

#225380
May 23, 2012 at 3:25pm

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.

#225381

You must be logged in to reply to this topic.