Any electromechanical device designed to convert sound into an electrical signal.
A microphone converts an acoustic waveform consisting of alternating high and low air pressure travelling through the air into a voltage. To do this it uses some kind of pressure or movement sensor. The simplest kind of microphone is actually very similar in construction to a loudspeaker.
The analogue electrical signal can be fed into a computer's sound card where it is amplified and sampled to convert it into a digital waveform for storage or transmission.