Hitting the Books: Ever wonder how audio sampling works?

All about dat Hertz.

Welcome to Hitting the Books. With less than one in five Americans reading just for fun these days, we've done the hard work for you by scouring the internet for the most interesting, thought provoking books on science and technology we can find and delivering an easily digestible nugget of their stories.

The Discrete Charm of the Machine: Why the World Became Digital
by Ken Steiglitz

Book cover

We're living the audiophile dream! Our phones can hold a year's worth of music and stream more songs than anyone could listen to in a lifetime. But none of that would be possible without the efforts of one Harry Nyquist, an engineer at Bell Labs in the 1920s, and his research into improving turn-of-the-20th-Century telephone signals.

In The Discrete Charm of the Machine, author Ken Steiglitz -- himself a pioneer in digital signal processing -- examines the underpinnings of our culture's rapid digitization; explains in clear, concise language how today's technologies grew from their analog forerunners; and even provides a few hints at where we might be headed.

A signal in the real world is always limited in how high a frequency it can contain. The reason is similar to the reason that transistors are limited in their speed of operation; all electronic devices have a certain amount of capacitance, which limits the speed with which charge can accumulate, which limits the speed with which voltages can change. Mechanical devices have a corresponding amount of inertia. These factors limit the highest frequency that a real signal in any particular physical environment can contain. The point is that we need to worry only about sampling the highest frequency in a signal. The lower frequencies are easier, not harder, to represent at a given sampling rate.

The idea of a "pure" tone of a given frequency is often introduced as a sine wave, the familiar waveform that goes up, levels off, then goes down, levels off, and so on. The function sine is referred to as a "circular" function, for the following reason: Picture a rotating circular disk, horizontal, a roulette wheel if you like, with a point of light (from an LED, say) glued to a fixed point near its edge. If we darken the room, we see the light rotating continuously at a given rate, at a certain frequency in "cycles per second," or Hz. If you kneel down and look at the disk from the side, the light goes back and forth, and, in fact, it will describe precisely the waveform called a sine wave. This is a great convenience, because we can now think about the rotating disk, which is much easier to visualize, and a more precise picture than an undulating wave. As an aside, I point out that physicists and engineers make heavy use of this alternative representation of a sine wave, albeit mathematically, in the form of a complex-valued function called a phasor. Richard Feynman wrote a marvelous little book, called QED, explaining quantum electrodynamics in simple terms, and he uses the picture of a little spinning disk throughout.

Now, instead of leaving the LED on steadily as the disk rotates, flash it periodically. Each flash corresponds to a sample of the position of the little light as it turns with the disk. If we sample many times for each rotation of the disk, we have no trouble representing the true rate at which the disk is turning. However, if we try to get away with slower sampling, we reach a point where we are sampling exactly twice for each rotation of the disk, and the little point of light will just flip back and forth between two positions 180◦ apart. If we now try to get away with slower sampling, flashing (sampling) the light a little less often than twice per rotation, slower and slower, a rather bad (but interesting) thing happens: the little light appears to turn in the direction opposite to its actual direction. If we slow the flashing down to only once per rotation, the flashing light appears stationary. If we flash even slower than once per rotation, the little light appears to start rotating in the correct direction but at a very slow rate—much slower than the true rate of the disk.

This is exactly what happens in an old Western movie when the stagecoach draws to a stop. The wagon wheels appear to turn in the wrong direction, slow down, start turning in the right direction, and so on, until they appear to be turning in the correct direction, more and more slowly, until they finally draw to a stop. The sampling behind this phenomenon is the frame rate of the movie camera, which is standardized at 24 frames per second. When the wagon wheel is turning faster than 12 times a second, we are in effect sampling at a rate less than twice per rotation, and the image shows a fraudulent representation of the speed of the wheel. In fact, practitioners of digital signal processing (DSP) call such a fraudulent frequency an alias of the true frequency.

We can now draw the promised elegant conclusion from this imaginary experiment: To capture faithfully the frequencies in a signal, we must sample at a rate at least twice the highest frequency present in the signal. Put the other way around, if we sample at a given rate, we must limit the highest frequency present in the signal to half the sampling rate. This latter rate is now called the Nyquist frequency.

Harry Nyquist worked for Bell Telephone Laboratories, which was very concerned with communication problems from the early days of the twentieth century, for obvious reasons. He explains his principle in Nyquist (1928a), but his explanation is in terms of telegraph terminology that is 90 years old, and he is not always easy to interpret. But Nyquist's principle, sometimes called his sampling theorem, is there.

What this means in our modern world, for example, is that audio signals, which are usually limited to frequencies (well) below 20 kHz, need to be sampled at a rate of at least 40 kHz. In fact, the standardized sampling rate used by compact discs is 44.1 kHz. Exactly the same ideas apply to A-to-D conversion of video signals, but the rates are much higher.

Excerpted from THE DISCRETE CHARM OF THE MACHINE: Why the World Became Digital by Ken Steiglitz. Copyright © 2019 by Princeton University Press. Reprinted by permission.