Forums > MaxMSP

comparing lists

January 20, 2012 | 3:45 am

Hello all!
Im fairly new to max which im loving so far put i think ive hit my first wall..

I have a list of frequencies that is constantly updating(these are peaks that ive detected with ~fiddle), and Im trying to catch a frequency as it dissapears from the list.

The way I was going to do it was monitor my list and constantly compare the new list as it comes in to the list that came before it.

So Im trying to compare 2 lists of frequencies to see which elements of one list do or do not appear in another, which sounds easy enough, but my frequencies are floats that are always slightly different – I want it to realize that 79.0930 is the same as 81.0028.

How would you go about this?


January 20, 2012 | 4:28 am

use one of the zl modes – forget which


January 20, 2012 | 5:02 am

Hi Jamesson,
Yeah thats what I thought, i think its called zl compare. But from my understanding it doesnt work if the values it compares arent exactly the same.

I need a threshold setting, for example if my first number is 8.0 i want it to search for anything close to 8.0, not just esactly 8.0

The other thing that zl compare seems to do is only compare the index 1 in list A with the index 1 in list B. I want to compare index 1 in list A with every element of list B.

I could be misunderstanding the way to process things with zl


January 20, 2012 | 6:52 am

see under; round


January 20, 2012 | 7:16 am

zl sect does the job; in this example I convert the lists into a streams to round the elements to a required accuracy and then convert back to a list to compare; but you could use vexpr to round the elements which would make it more efficient, if you can figure out how to do rounding with it

edit forget about what I said– round processes lists as stated by jamesson, here:

– Pasted Max Patch, click to expand. –

January 20, 2012 | 12:13 pm

Wow thanks guys! rounding is the way to go, that example works great.

its so simple I dont know why i was making it so complicated..


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