Sound Basics
To understand how speakers work, you first need to understand how sound works.
Inside your ear is a very thin piece of skin called the eardrum. When your eardrum vibrates, your brain interprets the vibrations as sound -- that's how you hear. Rapid changes in air pressure are the most common thing to vibrate your eardrum.
An object produces sound when it vibrates in air (sound can also travel through liquids and solids, but air is the transmission medium when we listen to speakers). When something vibrates, it moves the air particles around it. Those air particles in turn move the air particles around them, carrying the pulse of the vibration through the air as a traveling disturbance.
To see how this works, let's look at a simple vibrating object -- a bell. When you ring a bell, the metal vibrates -- flexes in and out -- rapidly. When it flexes out on one side, it pushes out on the surrounding air particles on that side. These air particles then collide with the particles in front of them, which collide with the particles in front of them and so on. When the bell flexes away, it pulls in on these surrounding air particles, creating a drop in pressure that pulls in on more surrounding air particles, which creates another drop in pressure that pulls in particles that are even farther out and so on. This decreasing of pressure is called rarefaction.
In this way, a vibrating object sends a wave of pressure fluctuation through the atmosphere. When the fluctuation wave reaches your ear, it vibrates the eardrum back and forth. Our brain interprets this motion as sound.
Differentiating Sound
We hear different sounds from different vibrating objects because of variations in:
Sound-wave frequency - A higher wave frequency simply means that the air pressure fluctuates faster. We hear this as a higher pitch. When there are fewer fluctuations in a period of time, the pitch is lower.
Air-pressure level - This is the wave's amplitude, which determines how loud the sound is. Sound waves with greater amplitudes move our ear drums more, and we register this sensation as a higher volume.
A microphone works something like our ears. It has a diaphragm that is vibrated by sound waves in an area. The signal from a microphone gets encoded on a tape or CD as an electrical signal. When you play this signal back on your stereo, the amplifier sends it to the speaker, which re-interprets it into physical vibrations. Good speakers are optimized to produce extremely accurate fluctuations in air pressure, just like the ones originally picked up by the microphone.
Making Sound
Microphones translate sound waves into electrical signals, which can be encoded onto CDs, tapes, LPs, etc. Players convert this stored information back into an electric current for use in the stereo system.
A speaker is essentially the final translation machine -- the reverse of the microphone. It takes the electrical signal and translates it back into physical vibrations to create sound waves. When everything is working as it should, the speaker produces nearly the same vibrations that the microphone originally recorded and encoded on a tape, CD, LP, etc.
In space, no one can hear you scream ... because there is no air or other medium for sound to travel. Sound needs a medium; an intervening substance through which it can travel from point to point; it must be carried on something. That something can be solid, liquid or gas. They can hear you scream underwater ... briefly. Water is a medium. Air is a medium. Nightclub walls are a medium. Sound travels in air by rapidly changing the air pressure relative to its normal value (atmospheric pressure). Sound is a disturbance in the surrounding medium. A vibration that spreads out from the source, creating a series of expanding shells of high pressure and low pressure ... high pressure ... low pressure ... high pressure ... low pressure. Moving ever outward these cycles of alternating pressure zones travel until finally dissipating, or reflecting off surfaces (nightclub walls), or passing through boundaries, or getting absorbed -- usually a combination of all three. Left unobstructed, sound travels outward, but not forever. The air (or other medium) robs some of the sound's power as it passes. The price of passage: the medium absorbs its energy. This power loss is experienced as a reduction in how loud it is (the term loudness is used to describe how loud it is from moment to moment) as the signal travels away from its source. The loudness of the signal is reduced by one-fourth for each doubling of distance from the source. This means that it is 6 dB less loud as you double your distance from it. [This is known as the inverse square law since the decrease is inversely proportional to the square of the distance traveled; for example, 2 times the distance equals a 1/4 decrease in loudness, and so on.]
How do we create sound, and how do we capture sound? We do this using opposite sides of the same electromagnetic coin. Electricity and magnetism are kinfolk: If you pass a coil of wire through a magnetic field, electricity is generated within the coil. Turn the coin over and flip it again: If you pass electricity through a coil of wire, a magnetic field is generated. Move the magnet, get a voltage; apply a voltage, create a magnet ... this is the essence of all electromechanical objects.
Microphones and loudspeakers are electromechanical objects. At their hearts there is a coil of wire (the voice coil) and a magnet (the magnet). Speaking causes sound vibrations to travel outward from your mouth. Speaking into a moving-coil (aka dynamic) microphone causes the voice coil to move within a magnetic field. This causes a voltage to be developed and a current to flow proportional to the sound -- sound has been captured. At the other end of the chain, a voltage is applied to the loudspeaker voice coil causing a current to flow which produces a magnetic field that makes the cone move proportional to the audio signal applied -- sound has been created. The microphone translates sound into an electrical signal, and the loudspeaker translates an electrical signal into sound. One capturing, the other creating. Everything in-between is just details. And in case you're wondering: yes; turned around, a microphone can be a loudspeaker (that makes teeny tiny sounds), and a loudspeaker can be a microphone (if you SHOUT REALLY LOUD).