Comparing 8 digital inputs to control multiplexer analog inputs

5-7Khz should be easily doable. If original is sinewave, converted to squarewave,
then pulsein() should be usable. I think you're in business.