How It Works: Sampling
For our explanations, consider the analog signal found in Figure 1. Let’s assume that it is an audio signal, since this the most popular applications for analog-to-digital and digital-to-analog conversions. The “y” axis represents voltage while the “x” axis represents time.
What the ADC circuit does is to take samples from the analog signal from time to time. Each sample will be converted into a number, based on its voltage level. In Figure 2 you see an example of some sampling points on our analog signal.
The frequency on which the sampling will occur is called sampling rate. If a sampling rate of 22,050 Hz is used, for example, this means that in one second 22,050 points will be sampled. Thus, the distance of each sampling point will be of 1 / 22,050 second (45.35 µs, in this case). If a sampling rate of 44,100 Hz is used, it means that 44,100 points will be captured per second. In this case the distance of each point will be of 1 / 44,100 second or 22.675 µs. And so on.
During the digital-to-analog conversion, the numbers will be converted again into voltages. If you think about it for a while, you will see that the waveform resulted from the digital-to-analog conversion won’t be perfect, as it won’t have all the points from the original analog signal, just some of them. In other words, the digital-to-analog converter will connect all the points captured by the analog-to-digital converter, any values that existed originally between these points will be suppressed.
You can see an example in Figure 3, where we show how the signal would be after being converted to digital and back to analog. As you can see, the original waveform is more “rounded”.
So, the more sampling points we use – i.e., the higher the sampling rate –, the more perfect will be the analog signal produced by the digital-to-analog converter (DAC). However, the more samples we capture more storage space is necessary to store the resulting digital data. For example, an analog-to-digital conversion using a 44,100 Hz sampling rate will generate twice the number of data as a conversion using a 22,050 Hz sampling rate, as it will capture twice the samples from the original waveform.
If you use a low sampling rate, the waveform generated at the DAC will be very different from the original analog signal. If it is music, for example, the music you will play will have a very bad quality.
So, we have this dilemma: if the sampling rate is too high, the output quality will be close to perfection, but you will need a lot of storage space to hold the generated data (i.e., the generated file will be very big); if the sampling rate is too low, the output quality will be bad.
How can you know the best sampling rate to be used during analog-to-digital conversions to have the best storage/quality balance? The answer is the Nyquist Theorem.
This theorem states that the sampling rate on analog-to-digital conversions must be at least two times the value of the highest frequency you want to capture.
Since the human ear listens to sounds up to the frequency of 20 kHz, for music we need to use a sampling rate of at least 40,000 Hz. In fact, the CD uses a 44,100 Hz sampling rate, thus capturing more than our ears can hear (this value was arbitrated by Phillips and Sony when they created the CD). Some professional audio applications use an even higher sampling rate.
The phone system, on the other hand, was created to transmit only human voice, which has a lower frequency range, up to 4 kHz. So on the digital part of the phone system, an 8,000 Hz sampling rate is used. That’s why if you try to transmit music through the phone the quality is bad: the phone circuitry cancels all frequencies above 4 kHz (ask a friend to put his/her phone near a stereo playing and you will hear what we are talking about).