Inside a speaker:
2. Electromagnet (coil)
3. Permanent magnet
In order to translate an electrical signal into an audible sound, speakers contain an electromagnet: a metal coil which creates a magnetic field when an electric current flows through it. This coil behaves much like a normal (permanent) magnet, with one particularly handy property: reversing the direction of the current in the coil flips the poles of the magnet.
Inside a speaker, an electromagnet is placed in front of a permanent magnet. The permanent magnet is fixed firmly into position whereas the electromagnet is mobile. As pulses of electricity pass through the coil of the electromagnet, the direction of its magnetic field is rapidly changed. This means that it is in turn attracted to and repelled from the permanent magnet, vibrating back and forth.
The electromagnet is attached to a cone made of a flexible material such as paper or plastic which amplifies these vibrations, pumping sound waves into the surrounding air and towards your ears.
The frequency of the vibrations governs the pitch of the sound produced, and their amplitude affects the volume – turn your stereo up high enough and you might even be able to see the diaphragm covering the cone move.
To reproduce all the different frequencies of sound in a piece of music faithfully, top quality speakers typically use different sized cones dedicated to high, medium and low frequencies.