Forums > MaxMSP

Compare lists with a bit of fuzz…

December 17, 2013 | 3:37 pm

Can anybody help me with this problem: I want to compare incoming lists of 6 floats (readings from two different movement sensors) with one (or many) previously recorded lists. However, I need the comparison to be done in a fuzzy way, so that you wouldn’t need to hit the exact same list for the comparison to be triggered. Basically I need to compare 6 floats to 6 ranges of floats. i was thinking of using a bunch of split objects to define ranges for each of the values, but it seems a bit kludgy to do so. I could imagine this would work with some kind of javascript solution, but I don’t really know how to code in javascript. So any idea on how to accomplish this using max objects only would be much appreciated. I have a feeling that the project will be more than heavy on my CPU as well, so any very elegant and computationally cheap solution would be great.

December 19, 2013 | 5:16 am

Ok how about using vexpr to subtract the two lists, using abs we can get an absolute value for the differences between the list items.

‘sort -1′ will re-arrange the list with the biggest deviation first

then just chop off the first deviation with ‘slice 1′ and compare it to your fuzz amount to see if there is a fuzzy match.


– Pasted Max Patch, click to expand. –


December 19, 2013 | 5:24 am

@Leafcutter: Wow, that’s just sooooo much more elegant than the solution I contrived…. Thanks a lot! For your amusement, here’s what I came up with (and will probably discard now :-))


– Pasted Max Patch, click to expand. –


December 19, 2013 | 5:24 pm

Wonderful, there a million and one ways to skin a max cat.

Once you get into vexpr and the zl objects you can make your life a lot more compact!

December 20, 2013 | 12:30 am

So it seems :-) Thanks again. Your solution is now the backbone of my patch (with a lot of tweaks and changes, but the basic idea is there…)

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