And Then There Was Sound…
Sound is one of those physical manifestations that has a circular definition. If you went out on the street and asked people what sound is, most of them would probably reply with, "Hmmm, stuff you hear with your ears, like sounds and noises." (Go ahead, try it…) That's true, but it still doesn't get you closer to the actual physics of sound, and that's important if you're going to record, manipulate, and play sound.
Sound is a mechanical pressure wave emitted from a source, as shown in Figure 10.1. Sound can exist only in an environment such as our atmosphere, which is filled with gases such as nitrogen, oxygen, helium, etc. Sound can travel in water also, but it moves at a much higher velocity than in air because the medium's increased density makes it more conductive. Sort of. Close enough. :)
A sound wave is really the motion of molecules. When a speaker moves in and out, it moves the surrounding air in and out mechanically, that is, by contact with the molecules, and at some point the sound wave makes its way to your ears. However, because sound travels by a wave propagating through the air via mechanical collisions, it takes time to get to you. That's why sound travels so slowly, relatively speaking. You can see something happen, such as a car crash, and not hear it for a second or two if it's happening far enough away. This is because a mechanical wave in air, or sound wave, can only travel at about 750 MPH or 344 m/s (meters per second), more or less depending on the density and temperature of the air. Table 10.1 lists the velocities of sound in air, seawater, and steel, for average temperatures.
Looking at Table 10.1, you can see why sonar works so well underwater but sucks in air (it's too slow, for one thing). A sonar pulse, or ping, travels underwater at 1,478 m/s or, roughly, 14.78 m/s x 3.2 ft/m x 1 mi/5280 ft x 3,600 seconds/1 hour = 3,224.7 miles per hour! This, compared to the average of 750 miles per hour for sound in air, should tell you why sonar scans are almost instantaneous for objects that are moving underwater and within reasonable distance.
If you're interested, the velocity of sound c (not to be confused with C the note, or c the speed of light) is equal to the frequency x wavelength, or f*l. In addition, the velocity can be computed based on factors like tension and density of the medium with this equation:
c = sqrt(tension factor/density factor)
where the tension and density are context-sensitive and only a loose starting point. In real life, there are a number of versions of this equation for gases, solids, and liquids.
Moving on, sound is a mechanical wave that travels through air at a constant velocity—the speed of sound. There are two parameters a traveling sound wave can have: amplitude and frequency. The amplitude of the sound is how much air volume is moved. A large speaker (or someone with a big mouth) moves a lot of air, so the sounds are stronger or more intense. The frequency of the sound is how many complete waves or cycles per second are emanating from the source, and is measured in hertz, or Hz. Most humans can hear in the range of 20-20,000Hz.
Furthermore, the average male has a voice that ranges from 20-2,000Hz, while a female voice ranges from 70-3,000Hz. Men have more bass, and women have more treble. Figure 10.2 shows the amplitude and frequency of some standard waveforms.
A waveform can be thought of as the shape of a sound's amplitude changes. Some sounds change smoothly, while other sounds rise up and then sharply fall off. Even if two sounds have the same amplitude and frequency, their particular shapes will make them sound different to us.
Lastly, we hear sound with our ears, which may seem simple enough, but here's the real story (like I'm going to lie). Your ears have a sensing array of little hair-like structures called cilia. Each of these cilia can detect a different frequency range. When a sound enters your ear as a wave train of pressure pulses, these cilia oscillate and resonate based on the sound and send signals to your brain. Your brain then processes these signals into the conscious perception of sound. However, on some planets the creatures might "see" sound, so remember that this whole sound thing is totally subjective. The only thing that is constant in the universe is how sound travels and the physics of sound. However, this is only true for regions of space that aren't warped, like near a black hole or on the freeways in California.
In review, a sound is a pressure wave that is expanding or contracting and moves air around. The rate of these contractions or expansions is called the frequency, and the amount of air moved is related to the relative amplitude or volume of the sound. Also, there are different waveforms of sound, such as sine waves, square wave, saw tooth waves, and so on. Humans can hear in the range of 20-20,000Hz, and the average human voice is about 2,000Hz. However, this is not the whole truth.
A single pure tone will always have the shape of a sine wave, but it can have any frequency and amplitude. Single tones sound like electronic toys or touch-tone phone tones (technically, touch-tone phones make two tones per button or DTMF, but close enough). The point is that in the real world, most sounds, like voices, music, and the ambient noises of the outdoors, are composed of hundreds or even thousands of pure tones all mixed together. Hence, sounds have a spectrum.
The most basic waveform in the universe is the sine wave—SIN(t). All other waveforms can be represented by a linear combination or collection of one or more sine waves. This can be proven mathematically with the Fourier Transform, which is a method of breaking a waveform down into its sinusoidal components. And it's also a way of giving math majors serious headaches!
The spectrum of a sound is its frequency distribution. Figure 10.3 shows the frequency distribution for my voice. As you can see, my voice has many different frequencies in it, but most of them are low. The point is, to make truly realistic sounds, you must understand that sounds are composed of many simple pure tones at different frequencies and amplitudes.
That's all great, but your goal is to make the computer produce sounds. No problem; the computer can control a speaker with electrical signals, forcing it to move in and out at any rate, with any force (within reason). Let's see how.