alternatives to (un)pack

Jan 17, 2012 at 10:14pm

alternatives to (un)pack

Is there some neater way to do this?

– Pasted Max Patch, click to expand. –

To be specific, I’m trying to split a test string and 32 floats while keeping the floats together and in order. Surely there’s a better way than the above mess?

Thanks much

Joe

#61291
Jan 17, 2012 at 10:26pm

In your example, are you always dealing with a list comprising a single symbol followed by n (32 in your case) floats?

[zl slice 1]

Will do the trick

#220971
Jan 17, 2012 at 10:28pm

[edit willyc beat me by a minute, but only because I provided an example :-) ]

– Pasted Max Patch, click to expand. –
#220972
Jan 17, 2012 at 10:33pm

They say a patch is worth a thousand words….

#220973
Jan 17, 2012 at 10:54pm

Awesome, thanks!

#220974
Jan 18, 2012 at 7:04pm

also, in the case of OSC, a structure like this can help keep your hierarchy of incoming messages intact over time, as the number of inputs grows:

– Pasted Max Patch, click to expand. –
#220975
Jan 18, 2012 at 11:37pm

Wittenberg

Sorry, I’m confused about what this does

Thanks

Joe

#220976
Jan 19, 2012 at 6:21am

It strips away / and makes it a space instead, so you can use a normal [route] object to parse the message.

But again, this was in the case of OSC – if you’re not using that then just ignore it.

#220977
Jan 19, 2012 at 6:43am

Oh, that’s what cnmat oscroute is for – do you know it?

#220978
Jan 19, 2012 at 7:32am

yes, and I’m using regexp instead :)

#220979
Jan 19, 2012 at 7:32am

and there’s jmod.oscroute too, which is nice as well.

#220980

You must be logged in to reply to this topic.