Comparing 8 digital inputs to control multiplexer analog inputs

As I understand it, pulsein() measures pulsewidths, not #pulses in a time
period. If you know the inputs are squarewave, and running at a constant
frequency, however, then pulsein() should give you a good measure, ie
freq = 1/(2*pulsewidth).

Otherwise, whether or not you can do the job depends upon the pulse frequency
on your 8 channels. You didn't say what the 8 digital frequencies are.

Also, using 3 digital I/O pins to select the 4051 channel is the easy part.