Build an Audio Waveform Display #75
Chapter 10, Audio
panel. Then you’ll wrap up the complete audio display by combining sev-
eral waveform panels to display multi-channel audio.
Some Basic Deﬁnitions
You’ll need to know a few basic terms and concepts about audio before you
One measurement of audio data. For Pulse Code Modulated (PCM)
encoding, a sample is an instantaneous representation of the voltage of
the analog audio. There are other types of encoding, like µ-law and a-law,
that are rarely used.
The number of samples in one second. Measured in Hertz (Hz) or kilo-
Hertz (kHz). The most common sampling rate is 44.1 kHz (CD quality
audio). Often, you’ll find 22.05 kHz or 11.025 kHz on the Web, since
the files are smaller and the conversion is easier.
The number of bits in one sample. It is typically a multiple of eight
because data is stored in 8-bit bytes. The most common sample size is 16
bits, which is CD quality audio. Often you’ll find 8-bit audio because the
files are smaller. You’ll rarely find anything less then 8-bit audio because
the quality is pretty poor. Sample size is sometimes called bit depth.
A channel is an independent stream of audio. Stereo is the most com-
mon form of multi-channel audio—one independent left and right
channel. Higher-end audio formats include 5.1 surround sound (actu-
ally six channels) and up.
Figure 10-5. The waveform display you’ll build in this hack