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).