ARTICLES

Analog to Digital Conversion - Part II: Bit Depths and Quantization

a "bit" of humor to "process" 


In previous posts we've covered sound pressure waves, transducers, analog audio, preamplifiers and amplifiers, waveforms, binary basics and digital audio sample rates. This article assumes that you already have a handle on these fundamentals. If you find yourself a little confused about the terminology presented here you might want to review the earlier posts.

This time we're going to tackle bit depths and quantization: how your analog to digital converter (ADC) will be forced to interpret or round-off the levels of continuous analog signals that fall in between the fixed values of a digital sampler. This rounding-off of values is called "quantizing" or sometimes"rounding-error".  In this case don't let the word "error" make you think that the system is malfunctioning; it's how this stuff was designed to work. And once you understand the basics it's actually a pretty simple process.

If this is new to you the concept of continuous analog vs. fixed digital may seem a little abstract. So let's start with a with an analogy that we can all relate to.

Analog vs Digital Clock 


An analog and a digital clock are synchronized. When the minute hand on the analog clock hits 12:05 the digital clock also reads 12:05.

Over the next 59 seconds the minute hand on the analog clock moves gradually foward. Although it's moving slowly it is continuously moving. In the meantime the digital clock continues to display 12:05.


It's not until the analog clock hits exactly 12:06 that the numeric display on the digital clock bumps over and both are in sync again.

In this example the analog clock is capable of conveying much more information than the digital clock.

Increasing Resolution Increases Accuracy

If we need more information from the digital clock we could increase its resolution by adding two digits to the right of the minutes column displaying seconds. If we were timing a sporting event we may need even more accuracy from the digital clock. In that case we'd need to increase its resolution further by adding more fields to display milliseconds. We could go on subdividing time values on our digital clock and increasing its resolution almost forever. But at some point the digital clock is going to give us all the information we need to get our work done. Increasing its resolution beyond this wouldn't be useful and it would make the digital clock more complicated and expensive to manufacture.


Analog vs Digital Audio

A continuously varying analog audio signal is represented in red. The green dot illustrates a single digital sample: an analog voltage measurement converted to a 16 bit digital word

  • An analog audio signal consists of a continuously varying voltage (change in electron pressure). 
  • A digital audio sample is not continuous: it  has a finite number of possible values to work with.


Analog to Digital Conversion

In order to capture and encode a digital audio sample a circuit called an analog to digital converter (ADC) is used. 
  • The ADC repeatedly measures the amplitude (intensity or loudness) of the analog signal at  regularly timed intervals.
  • Each individual measurement is converted to a binary number and stored. 
  • Each digitally stored measurement is called a sample. 
  • Allocating more bits to each sample increases its resolution and therefore the accuracy of each measurement. 
Got that? Let me see if we can make it a little simpler.

The images below illustrate what might happen if we tried to digitally capture an analog audio signal with an ADC using just one bit.

  • The graphic on the left describes an analog input signal before it hits the ADC. Notice that as the frequency of the signal repeats its amplitude decreases.
  • Each green dot (sometimes called a "lollipop" graph) on the center graphic illustrates a single digital sample. A one bit converter would have only two possible fixed values to choose from: "1" or "0" (labeled on the graph's vertical axis). Notice that:
    • if the amplitude of the analog signal goes above the center line the ADC must quantize (round) the value up and assign it a digital "1"
    • if the analog signal falls below the center the ADC must quantize the value down and assign it a digital "0"
  • On playback the digital to analog converter (DAC) looks at the values of the encoded samples (lollipops) and uses them to construct a new analog output. While the frequency content of the input is maintained all variations in amplitude are lost and our signal has been rendered to a square wave. 

Now let's increase the number of bits available to our converter from one to two and see how it increases resolution.

  • In this instance the center image depicts the same number of samples (the sample rate) as in the previous example. 
  • The ADC still must quantize the analog signal up or down to the closest available step. But by increasing the bit depth from one to two bits we've doubled the number of discrete values available to the converter to choose from. These are again labeled on the graph's vertical axis. 
  • On output the DAC uses the stored sample values to construct a new analog signal. Notice that while the output is still very distorted some of the amplitude variations of the input are beginning to reappear. 

Let's see what would happen if we upped our converters to three bits.

  • By increasing the ADC's bit depth from two to three bits we've again doubled the number of values that it has to work with from four to eight. Starting to see a pattern here? 
  • The sample rate remains the same as in the previous examples. The only thing that's changed is the sampler's bit depth. 
  • Our output is beginning more and more to look like (and sound like) the input.  
And here's the same signal quantized by a four bit converter.

  • By raising the number of bits available to the ADC from three to four we've again doubled the number of available quantize steps from eight to sixteen.
  • While our output still isn't identical to the input the variations in amplitude are nearly the same.
Starting to get the idea?
Adding additional bits to a sample allow it to capture an analog signal's amplitude with greater accuracy. 
Every additional bit that we allocate to a binary word doubles the number of values it can yield

Got it? If so I think you've managed to absorb the big picture that I hoped to convey here.

But before we wrap it up let's consider this:

If longer bit depths increase the resolution (and therefore the accuracy) of a digital sample, we might assume that at some point we could arrive at a bit depth where quantization becomes unnecessary. Right?

Nope. That's just not going to happen.

As you're recording your converter is firing off samples at a fixed frequency determined by its sample rate. As we found out in this article sample rates determine the highest audio frequency that your converter can accurately capture. However, your converter is  going to be recording these samples at regularly timed intervals regardless of the frequency or phase of the analog signal you're feeding it. The amplitude of your analog signal may just happen to happily coincide nicely with one of the quantized steps of a sample. But it's just as likely to fall somewhere in between the cracks.

And that's why we have something called dither. And that's what we'll cover next time. We'll also find out why your DAW hardware and software offers options for recording and processing samples at both 16 and 24 bit. Which means we'll also have to discuss dynamic range. And what is that 32 bit floating point thing anyway?



In the meantime: if you're interested in pursuing more information on the topic this book was my primary reference. It's also been one of the definitive texts on the subject for several decades.





A nice example of patience and practice

Before leaving I want to mention that I was a musician for many, many years before I became interested in audio technology. I still vividly remember how overwhelmed I was with all this jargon and terminology at first. None of it came easy for me. But with some patience and practice it all eventually started to make sense.

As much as I can I'm trying to approach these articles from a beginner's perspective. If you've read a post and still have questions post a comment and let me know. I'll do what I can to help. Really.

Thanks.




Karl Wenninger is an audio engineer, synthesist/sound designer, composer, guitarist and DIY audio electronics enthusiast. As an adjunct professor he has taught
 Pro Tools at The New School for Jazz and Contemporary Music, Computer Music at York College and Audio Post-Production for the Media Arts Program at NJCUHe was an program administrator and associate professor at the former Digital Media Arts program at Touro College in New York City for over a decade. 

3 comments:

  1. Hey after some feedback from a twitter user I'm posting my own comment:
    The graphics presented here are intended to illustrate that increasing bit depth increases the resolution of a digital audio sample. As noted by @dotjhw real-world DACs feature a reconstruction filter to help alleviate waveform distortions on output. These graphics simply demonstrate the process of quantization; the effects of an output reconstruction filter are not reflected in these diagrams.

    ReplyDelete
  2. Where is the Dither discussion?

    ReplyDelete
  3. Thanks for taking the time to discuss this, I feel strongly about it and love learning more on this topic. If possible, as you gain expertise, would you mind updating your blog with extra information? It is extremely helpful for me. Converter Tools

    ReplyDelete