We’ve been talking about digital audio for a while now.
We’ve talked about sampling, quantization and several nuanced topics along the way,
all in isolation, all hinting at a topic in the future where they may be combined together to get
a form of audio in the digital domain that can be transmitted and stored and used in the real world.
This is that topic. The final piece that lets us piece together all these digital transformations.
The final piece is encoding - a way of digitally representing sampled and quantized data.
The title of this video is Pulse Code Modulation, and pulse code modulation is
a specific type of encoding strategy. The reason we are talking about Pulse code modulation or
PCM specifically is because it’s the most common encoding scheme in use, the easiest to understand
and a classical method that’s been around since the dawn of digital audio. I’ll have you note that
there are several different alternative encoding schemes, with benefits and drawbacks of their own,
and we’ll briefly describe a few here, and go over them in more detail in future videos.
But we’ll start from scratch and build up to why PCM is a viable encoding strategy.
You’ve all heard of FM before in the context of radio transmission. FM is frequency modulation.
Let's say you have a piece of music or speech, and you want to transmit it wirelessly across large
distances. You’ll find that doing this directly, transmitting the audio signal directly is
very limiting, and you won’t get very far. For starters, the audio band, between 20Hz and 20Khz,
just doesn’t have enough power and would need a lot of amplification to be transmitted even
short distances. And if you receive it on the other side and try to play it back, it’ll turn out
to be very noisy, since there’s a lot of natural and man made interference in the atmosphere.
Engineers found ways of storing and encoding the music or speech in unique ways, and frequency
modulation is one of these ways. We start with a really high frequency carrier wave, which is going
to carry our music, which is going to be encoded within it. We modulate the frequency parameter
of this carrier wave corresponding to the instantaneous changes of amplitude in the music
signal. The change in amplitude of the music is encoded as change in frequency within the carrier.
This carrier signal has loads of advantages during transmission. Since it has a very
high base frequency, it has a lot of energy and can be transmitted larger distances with little
amplification. And since the music is encoded within the frequency of the carrier, and since
interference noise only affects the amplitude, the underlying music is unaffected by environmental
noise. Once we receive the carrier signal however, it can’t directly be played back. The carrier
signal would need to be reverse engineered and demodulated to extract the music signal from it.
All of what I described here happens purely in the analog domain. There are no digital
signals here nor any digital processes. So why did I talk about Frequency modulation here?
I talked about it, because the concept of modulation and encoding are transferable concepts
and can be used in the digital domain. Modulation is simply a means of encoding information for
purposes such as transmission or storage. Here, instead of modulating the frequency, we could
just as easily have modulated the amplitude of the carrier wave or the phase, and in fact,
these are legitimate encoding schemes, amplitude modulation and phase modulation.
They come with their own set of advantages and disadvantages. But all that matters is
the underlying music, and the use case that determines which type of modulation to use.
There may be several different encoding schemes but they have a singular purpose - to transmit
or store the underlying music as faithfully as possible, without any changes to the original.
Frequency modulation, as mentioned before, applies to continuous analog signals.
For the transmission and storage of discrete digital signals, we need a different approach.
Let’s take this sinusoid for instance in it’s analog form. To begin the process of
transformation from analog to digital, we need the prerequisites, sampling and quantization.
Enough has been said about these 2 processes already, so to sum them up, sampling is simply
the process of chopping the signal along the time axis, at equal intervals of time. We are only
interested in the signal’s instantaneous amplitude at these specific intervals. Quantization on the
other hand, is simply the process of placing a limit on the number of possible discrete values
that the amplitude level can take on. As an example, let’s say that this analog signal
is now sampled at 44.1kHz, and quantized at a bit depth of 16bits, or 65536 discrete levels.
The hard part is done. Now the challenge is, how do we represent these sampled values as a signal
that can be transmitted along a channel, or saved on to a disk. How do we represent this signal
so that when we pass it down to another system, say a digital to analog converter, it would have
the blueprint to recreate the original analog signal exactly. We could make use of pulses.
Pulses are precise time-controlled electrical signals. The timing of these electrical
pulses are controlled by a very accurate clock, usually a precisely cut piezo-electric crystal.
These pulses can be modulated according to the amplitude value at each sampling interval.
Pulse width modulation is an encoding technique where the width of a pulse is determined by the
amplitude of the sample. So at each sampling interval, a pulse is triggered with a width
correspondingly as large as the amplitude of the sample. The larger the amplitude, the
larger the width of the pulse. Another modulation technique which is quite similar is Pulse position
modulation, where a sharp pulse is triggered at the start of a sampling interval, and a secondary
pulse is triggered at a position which corresponds to the relative amplitude of the sample.
So, in this case, the larger the sample amplitude the further away is the secondary pulse from the
initial pulse. Quite simple so far right? Each sample is represented as a single pulse with
Pulse width modulation and as 2 pulses with Pulse position modulation. Fair enough. But how can this
encoded signal be demodulated. How do we take these pulses and determine the sample amplitude
from it. All we have is relative width or relative position to determine the sample amplitude. We n
solution to represent the 16 bit sample amplitude correctly, and to represent it perfectly, we need
65,536 distinct clock cycles between each sampling interval. This is an incredibly inefficient way
of encoding data, and the bandwidth required to transmit this encoded signal would be colossal.
Not only that, but since this type of modulation results in long periods of inactivity or
long periods where a pulse is present, a simple uncorrected error in the transmission channel
or on the receiving side could result in large deviations from the expected result.
Simply put, long chains of 0’s or 1’s could result in large errors. Another type of modulation
is Pulse amplitude modulation. Again, quite simple, we modulate the amplitude of the pulse
corresponding to the amplitude of the audio sample. Only in the most ideal circumstances
would this type of modulation even work. If you were to transmit this signal through a channel,
noise could easily creep in. Since noise affects the amplitude of a signal,
modulating the amplitude parameter of a pulse itself isn’t a great idea for transmission.
So here’s a lesson for us from Pulse Amplitude Modulation. A well modulated signal has to be
unaffected by amplitude changes. Take the Pulse Width modulated signal for example. No matter how
much noise enters a signal, no matter how badly disintegrated the signal is on the demodulating
end, just the presence or absence of a pulse is enough to distinguish between different amplitude
values. We only need to care about the precise position of the pulse, We don’t need to know
its precise amplitude. Just detecting whether a pulse is present or not is enough. The big problem
we saw when dealing with Pulse width modulation was the massive resolution needed. But each sample
amplitude can be expressed as a 16 bit binary number. What if, we could encode the binary number
itself as a series of pulses. That’s precisely what Pulse Code modulation does. Each sample value
is encoded as a binary number with the presence of a pulse treated as 1 and the absence of it
treated as a zero. This becomes a very viable strategy since we only need a resolution of 16
clock cycles between 2 sampling intervals to represent a 16 bit quantized audio signal.
We can easily calculate how much bandwidth a PCM encoded signal would occupy.
Bandwidth for digital signals and transmission media is measured in bitrate or information rate,
and determining bandwidth is quite essentially during transmission,
because a transmission channel such as a digital cable has a limited bit rate that it can accept,
and the bit rate of our encoded audio signal needs to be lower than that.
Bit rate is essentially calculated by how many bits are conveyed in 1 second of time.
In our particular example, there are 44100 samples in 1 second,
and the resolution of each sample is 16 bits. So simple math, 44100 times 16
which is 705,600 bits per second or 705.6kbps, for a single channel of audio. So the general
formula is just sample rate times the bit depth times the number of channels.
PCM is great because it bundles up all the information that our electronic components
spit out, and leaves nothing behind. It represents data in the digital domain as truly as physically
possible based on the electronic components chosen for the job of analog to digital conversion.
And that’s the reason why PCM encoded signals are said to be lossless in nature. All great, but it
still occupies a lot of damned bandwidth, and the core aim of many encoding schemes that came
after it was to reduce the bit rate, while still maintaining as much information as possible.
That was a lot of exhausting theory. But let’s just zoom out for a little bit.
So far, in this module, everything we’ve talked about is regarding the process of
converting a continuous analog signal into a PCM encoded digital signal. We discovered that this
analog to digital conversion process, which was once described as a tiny black box in a diagram,
has a lot of working parts and pieces that come together and make this happen.
Some pieces here might be familiar to you from our earlier discussion. And some may not. You don’t
need to know everything there is to analog-digital conversion, but just having a working knowledge of
it never hurts anybody. So in the next video we’ll briefly go through a few of the blocks here that
I haven’t covered yet such as multiplexing, error correction, channel coding and record modulation.
And then we can finally think about wrapping up this module. See you in the next one!