[HOW TO?] analysing lists

Mar 30, 2011 at 6:31pm

[HOW TO?] analysing lists

hi guys

Hope everything is just fine with all of you.
I need an hint on how to solve a problem.

I have an input of a list with four elements..

eg: 1 2 3 4

the values are intigers between 0 and 1

I then have a permutation of all those elements (4^2 = 16):


and then I want to analyse this list and detect which one is being triggered..

can you give me an hint on how to do this.. so that I can spend some time on it trying to solve this problem myself?

thanks in advance
tiago morgado

Mar 30, 2011 at 7:10pm

you can convert this binary representation to an int, then use [sel] to pick which one it is (0-15 are possible). lots of ways to do it.

Mar 30, 2011 at 7:18pm

ok.. thanks man.. I will try it..

Mar 30, 2011 at 7:31pm

you mean something like this right?

– Pasted Max Patch, click to expand. –

tiago morgado

Mar 30, 2011 at 9:59pm

or this:

– Pasted Max Patch, click to expand. –
Mar 30, 2011 at 10:12pm

thanks terry.. it’s a much more effective way of solving the problem.. and with a much more advanced programming max level.. in fact it almost seems that you’re making some c++ script by using maxmsp objects

Mar 30, 2011 at 11:43pm

If you’re interested, have a look at the help patches for these objects: the sprintf object uses C nomenclature, and the jstrigger object uses javascript

Mar 31, 2011 at 9:21am

If you need to scale this to different numbers of bits then you can use this alone without needing the [sprintf] object.alone without needing the [sprintf] object:

jstrigger (parseInt(parseInt(a.join().replace(',','','g'),2).toString(10)))

Apr 1, 2011 at 2:19am

in fact sprintf is a c/c++ function..
for simple operation jstrigger seems to be effective and you don’t need to create an external with js objects for putting simple instructions to maxmsp..

thanks guys


You must be logged in to reply to this topic.