Storing Sound

Early computer games used chips that created simple tones to produce electronic bleeps and whistles, but were incapable of producing complex sounds. These days, gaming hardware can store and reproduce real-life sounds to create a rich extra dimension to the gameplay. The sound card on your computer can both record and play back high-quality audio.

Sound can be represented as a wave. Figure 10-1 shows a sound wave that represents a brief portion of a sound (a fraction of a second)—a full sound would be much longer and more complex. The wave shows how the energy, or amplitude, of the sounds varies over time.

Sound waves form a number of peaks and troughs; the greater the difference in the amplitude of these peaks and troughs, the greater the volume of the sound. The pitch of the sound is determined by frequency of the waves (the distance in time between the peaks); the closer the peaks are together in time, the higher the sound will be.

To store a sound on a computer, you must first convert it to digital form, which you can do using a microphone plugged into the mic socket of your sound card, or the USB port for newer microphones designed specifically for computer use. When a microphone picks up sound, the wave is converted into an electrical signal, which is sampled at regular intervals by the sound card to produce a sequence of numbers that can be saved to a file. Samples are values representing the amplitude of a wave at a particular moment in time, and are used to reconstruct the wave when it is played back. The more samples you have, the more accurately the sound card can play back the sound. Figure 10-2 shows a wave reconstructed from a low sample rate, overlaid over the original. You can see that the sampled wave generally follows the real wave, but much of the detail is lost, resulting in low-quality sound. A higher sample rate would produce a wave that followed the original more closely, and would sound better when played back.

Sample rates are measured in hertz (Hz), which means samples per second, or kilohertz (KHz), which means thousands of samples per second. Phone quality is about 6KHz and CD quality is 44KHz. Samples rates can go higher than CD quality, but only dogs and bats will be able to tell the difference!

Figure 10-2. Sample sound wave

Was this article helpful?

0 0

Post a comment