A "Largest Number" object?

Kiamet's icon

Hi guys,

I'm learning how to use MaxMSP for a tech elective at uni. It's pretty fun. Anyway I was wondering if there was an object that can recieve a list of numbers and only output the largest one, or the 2 largest, or the three largest. I'd appreciate any help or advice.

The assignment I'm doing is a patch that can guess, relatively accurately, the key of the song you play into it, thru MIDI.

Trond Lossius's icon

maximum will give you the highest value of the list, but only one. If
you work on lists the Lobjects by Peter Elsea are also well worth
checking out. He has got an object named Ltop that reports the one or
more top values and their position in the list. Check www.maxobjects.com
for URL to download.

While you are at it, and depending on how much time you have, you might
also want to take a look at one of the tutorials about Fuzzy logics that
Peter Elsea is offering.

Best,
Trond

Casey wrote:
> Hi guys,
>
> I'm learning how to use MaxMSP for a tech elective at uni. It's pretty fun. Anyway I was wondering if there was an object that can recieve a list of numbers and only output the largest one, or the 2 largest, or the three largest. I'd appreciate any help or advice.
>
> The assignment I'm doing is a patch that can guess, relatively accurately, the key of the song you play into it, thru MIDI.

Emmanuel Jourdan's icon

On 26 sept. 06, at 07:12, Trond Lossius wrote:

> maximum will give you the highest value of the list, but only one.
> If you work on lists the Lobjects by Peter Elsea are also well
> worth checking out. He has got an object named Ltop that reports
> the one or more top values and their position in the list. Check
> www.maxobjects.com for URL to download.

You can also achieve that with standart objects : sort the list,
select the first n elements.

Max Patch
Copy patch and select New From Clipboard in Max.

Best,
ej

Roman Thilenius's icon

[peak]
[maximum]
[maximum~]
[>]-(prepend set)-[i]
...

adrjork's icon

Hi, everyone.
...but what if I want not only know which is the highest number, but also from where does it come?
I have 5 floats that represent 5 different streams of data (in the following example every stream has a different color). I want to know the highest value, but also which is its own stream color (for example if the highest value comes from red stream, then the final message could become red, otherwise if the highest value comes from green stream, then the final message could become green, etc.)

Thanks

Max Patch
Copy patch and select New From Clipboard in Max.

Example:

adrjork's icon

Sorry guys, I've yet found the answer: maximum right outlet!
Thanks anyway.