IC implementation of min function (looking for)

Hi all,

I'm trying to find an integrated circuit that implements the min function, as in `min(3, 4, 6) = 3` I'm having trouble with my search because the terms "min" and "minimum" are so heavily overloaded. Can someone please help me find either the IC itself, or the right search keywords?

I want to find a chip that maps N digital input pins to a smaller number of output pins that will carry the number of the lowest HIGH input pin. So, for instance, if it has 10 input pins and let's say that pins 3, 4, and 6 are all HIGH, the output will be 3 (which I can imagine would use either 4 digital output pins or a single analog pin).

The problem could also be that I'm thinking about this the wrong way. Here's some more context, if it helps:

I'm designing my first arduino project and I would like to make a USB midi controller. Specifically, I would like to make one that emulates an old monophonic synthesizer, meaning that even though it has 44 keys only one note will sound at a time. When multiple notes are pressed simultaneously only the lowest note will sound.

It seems like a shame to waste 44 inputs on the keys when only the lowest one will be active at any time. If I could find a solution to output the minimum HIGH pin out the 44 then I could reduce those 44 digital inputs down to 6 digital inputs or a single analog input. I realize that I can just buy a multiplexer and read all 44 pins through that, but I'm already buying a mux shield and an arduino mega in order to handle the huge number of inputs I will have (29 continuous and 59 discrete) so I would like to take advantage of the monophonic nature of the synth in hardware, rather than waste the inputs.

Thank you very much for your time!

It's called a "Priority Encoder":

74HC147 = 10-input -> 4-bit Priority Encoder http://www.nxp.com/documents/data_sheet/74HC_HCT147_CNV.pdf

74148 = 8-input -> 3-bit Priority Encoder http://www.jameco.com/Jameco/Products/ProdDS/49496TI.pdf

Either a priority encoder (74LS148) or a comparator (74LS85) ?

johnwasser:
It’s called a “Priority Encoder”:

Thanks, johnwasser! I really appreciate the help.

AWOL: Either a priority encoder (74LS148) or a comparator (74LS85) ?

A quick scan through the wikipedia entries for pritority encoder and comparator makes me think that the priority encoder is going to be the winner for my problem, but I'm going to dig deeper to find out for sure. I'll post an update once I figure it out.

I really appreciate the help - thank you!