The easiest way to MUX 40 signals is with five 4067 chips fed into a single digital input all controlled with a few outputs.
As this is a pretty slow signal you can drastically improve the response time by timing the waveform's period rather than counting pulses to get the frequency.
Do you need to know the actual RPM or just that it's out of a certain range?
Rob