This is achieved through an analog-to-digital converter, utilizing sampling and quantization.
How You Slice It
Sampling and quantization is like looking at the speedometer of your car. If you don’t keep a regular eye on your speed, your car might be going faster or slower than you realize.
Audio sampling is simply taking regular measurements of a varying analog voltage or current.
Because the audio voltage or current is constantly changing, we have to pick moments in time to freeze the audio as a non-varying number.
We must make measurements in a quick enough succession that we don’t miss important changes between measurements.
And we must measure with enough resolution that we capture as much detail as we desire.
Theory tells us that the rate at which the signal is sampled must be at least twice that of the highest frequency that we wish to reproduce.
The Nyquist Theorum, therefore, means that, to faithfully capture an analog audio signal that extends to the accepted upper threshold of 20 kHz, it must be sampled at 40 kHz, or 40,000 samples per second.
As an aside, the reason that the compact disc Red Book standard dictates a sampling frequency of 44.1 kHz is based on the early developers, Philips and Sony, wishing to cover the generally accepted audio spectrum of human hearing while also fitting the resulting digital information onto videotape.
By fitting three samples into each active line in the video field, at 50 Hz or 60 Hz, the developers were able to sample 44,100 times per second and save the data onto videotape, which was the digital audio storage and mastering precursor to the compact disc.
These days, we understand that the higher the sample rate, the better. Extending the sampling frequency well beyond the minimum 40 kHz allows digital processing tools to operate on the signal without compromise and to reduce alias signals.
Alias signals are basically components of the audio signal above the upper limit of the sampling frequency that are essentially folded back into the signal, creating an unpleasant distortion.
Someone once gave a good example of aliasing. A guy living in a cave was waiting for daylight. He stuck his head outside about every 25 hours.
Starting at 8 o’clock at night (8 pm), he next looked outside 25 hours later when, unbeknownst to him, it was 9 pm and still dark.
Poke your head out of a cave once every 25 hours or so, and you’re going to get an incorrect sampling of day-to-night ratio. So it goes with digital sampling.
Looking outside his pitch black cave every 25 hours he encountered night 10 times in a row, leading him to believe that the night was 10 times longer than it really was.
That is what aliasing is all about. It’s a false reality, created by not sampling the signal of interest frequently enough. If the knucklehead had looked every hour he would have seen the true length of night.
The same goes for audio sampling. If we don’t make enough measurements within a period of time, we miss important audio information and end up with incorrect sounds, harmonically unrelated to what we really wanted to capture.