A microphone uses the generator effect to turn sound into an electrical signal. Sound waves are pressure variations in the air. In a moving-coil microphone, they hit a thin flexible diaphragm and make it vibrate.
The diaphragm is attached to a coil of wire, which sits in the magnetic field of a permanent magnet. When the diaphragm vibrates, the coil moves backwards and forwards in the magnetic field, so a potential difference is induced across the coil.
The coil is part of a circuit, so a current is induced. As the coil moves in and out, the current changes direction. This is a varying current in the circuit with the same pattern as the sound wave. A louder sound makes the coil move further and faster, which gives a larger current. A higher pitch makes the coil vibrate more times each second, so the current changes direction more often.