Highest one from a b or c float

tedor's icon

Hello,

I wonder whether there is an object that can show which of its inlets has the highest value?

Any help appreciated.
Krisztian

code:

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

David Beaudry's icon

Your code doesn't show much of a starting point!

3 numbers >> pak 0. 0. 0. >> maximum 0. >> voila

one of several ways.

David

tedor's icon

hi David, thanks for the reply, yes my start is not the best, sorry.
with the use of maximum, I only get the value, not the sender, not the index/inlet number. Sorry if I was a bit unclear.
any help appreciated.
K

Roman Thilenius's icon

no max on this computer but i will try it blind.

step 1 is to find the highest value:

[pak 0. 0. 0.]

[maximum]

step 2 then ... comparing all input numbers versus the mean output:

[t l l]

[zl iter 1] [zl len]

[== 0.] (right inlet from maximum)

[zl group]

this will end up with a list "0 1 0", which can now be decoded
to three outlets using [unpack] and [select 1] or whatever you
want the output to be.

when i am back at max i can make you a better version for sure.

Tim Lloyd's icon

Maximum does give you the index of it's current highest input number. Maybe I'm misunderstanding what you need.

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

edit---- just read your post properly, don't mind me! ----

David Beaudry's icon

did you look at the help file for maximum? Take a look at the second outlet.

David

tedor's icon

hi, only the Max5 object does the second outlet, unfortunately.
My EEG patch seems to work faster on Max4

I will try what Roman Thilenius suggested.

thank you all.
Krisztian

tedor's icon

dear Roman

sMaRt !!!

thank very much.

Krisztian

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

Tj Shredder's icon

with zl sub it would be even easier, feed the output of maximum into the right inlet of zl sub, but pay attention on float types (your example had an int maximum but float pak...)

I am too lazy to fire up Max 4 to create the patch...;-)

tedor's icon

hello Stefan, yes you are right, it is easier, thanks a lot.
Krisztian

ch's icon

If you got only 3 inlets, you could use expr quite easily as well :

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

Charles

tedor's icon

hello Charles

thanks, good to know that there are many ways..
best, K

tedor's icon

Hello,
I wonder whether there is a way to make the following code a bit quicker (CPU friendlier) in Max 4.6.

I have 6 constantly changing inlets, where I look for the maximum. As a result I get a list with 0s and 1s. 1 is the maximum. The list is bang even if it doesn't change.

In the subpatch I would like to use channel that is on the maximum to trigger a sound, but only if it can keep being the maximum for a certain amount of time (3sec).

Is there a way to make this easier or smarter perhaps?

Any help appreciated,
all the best
Krisztian