Please post code between the brackets that pop up when you press the hash icon in the answer box.
It all depends on what your hardware is. You do not describe it. Do you have a peak detector on the front end? Is there a DC offset? What range of signals are you getting?
You can either have a low pass filter on the amplifier feeding a separate analogue input or you can have no filter and do the separation in software using a digital filter. Solenoids do not move that fast, not at audio rate so I assume you only want to pick up a beat, but I don't know.