With the release of the iPhone 7 and its very noticeable lack of a 3.5mm port, Apple has gone “all digital” as far as audio is concerned. For once, this is not mere marketing mumbo jumbo (looking at you, Retina Display). While Apple’s decision to ditch the headphone jack was also (supposedly) motivated by design considerations such as better waterproofing, the deviation from standards makes it an important event in the evolution and future history of personal audio devices. Join us as we delve into the basics of the electronic engineering that goes into audio technology to find out what it all means.
Analog Signals – The structure of Sound
Let us begin with a blank slate and work our way back from the conscious perception of sound. On second thought, let us just work our way back from the moment sound hits our ears.
At the risk of turning it into a platitude, we have to say it: Sound is a wave. As we’ve seen, waves need a medium to travel in. When you hear anything, the waves are variations in air pressure, which mechanically vibrate your eardrums. These air waves are created by the instruments (if you are listening to an acoustic performance), or by the vibrating membrane of the speaker. The speaker cone produces the desired sound because it is being fed the desired electrical signal, whose variations conform precisely with the curves of the sound wave. The point to be illustrated here is, the signal that goes into the speaker is an analog audio signal. Prior to that, the signal may have been analog or digital, and then passed through a DAC, which we will examine shortly. To record an analog signal from a source of sound, we need to arrange apparatus such that the instantaneous change in air pressure is directly proportional to the instantaneous change in some property of the physical media. Some years ago that was vinyl discs and magnetic tapes. The pattern of continuous change over time that exactly corresponds to the structure of the sound is the analog recording.
In today’s scenario, the physical media is electricity and the varying property is voltage, or sometimes current. In this case, we cannot store analog electrical signals as there are various problems associated with this idea, which we will see as we go digital.
The Digital Discourse
The brief history of today’s electronic technology begins with the humble three-terminal transistor. The discernible ON and OFF states of transistors led to logic gates which led to flip flops which led to registers and processors and combined with various types of sensors and actuators, resulted in the world of bits we have today. The essence of the world of bits is that everything is dualistic at its core. Something or nothing, 1 or 0, the fundamental digits. From that humble beginning, we have built systems as complex as climate simulation using increasingly higher levels of abstraction. Of course, there’s a third type of fundamental Digit, but that’s us, and we don’t like to brag.
Analog signals are continuous, their curve is smooth, whereas digital signals have steps, which represent discrete values. Of course, sound, like most other real world signals, always comes into existence as an analog signal. Then how does the audio become digital? The leap from analog to digital is magic that happens inside an ADC (analog to digital converter) and similarly, a DAC (digital to analog converter) performs the inverse function. It processes the digital audio into a signal that a speaker can play, perhaps after some amplification. ADCs and DACs are vital components of electronic technology and signal processing. Read on to understand how this all works!
Analog to Digital (A/D) conversion
An ADC is a device that takes as an input an analog signal and outputs binary values. It is usually implemented directly in an integrated circuit (IC) like the MCP3551 or ADC0808IC. There are two main aspects of the conversion process that are at odds with each other: Speed and Accuracy. For reference, take a look at the Illustrative Graph, which has been exaggerated for easily conveying an understanding of the process.
In blue we have the analog signal which is being passed into the ADC. This signal is continuous in time and amplitude. To convert this into a digital signal, it is ‘sampled’ at a particular periodic interval. Sampling simply means that the instantaneous value of the continuously varying signal is checked and assigned to one of the available discrete values. The number of values available to select from depends on the bit depth of the sampling ADC. For CD quality audio, the bit depth is 16 bits per channel (right and left). In the graph, this is the number of dashed black lines parallel to the time axis. Each dashed line corresponds to one of the discrete digital values that the signal can take. It is visually apparent that a higher density of dashed lines would mean more sensitivity and precision with regard to the values, as the digital value would be closer to the instantaneous analog value. Similar to the common video term, the bit depth can also be called the resolution of the audio.
As there is a time component, an ADC also has a clock in its IC which determines the speed of the sampling. The rate of sampling is called the sampling frequency, and is given by the number of samples per unit second. Thus, the sampling rate is a value with the unit in Hz. This value is 44KHz for CD quality audio, meaning 44000 samples are taken from the analog signal in one second, and each sample has a size of 16 bits (for one channel). In the Illustrative Graph, each red line corresponds to a single sample. Notice that they only extend up till the dashed line which is closest to the value of the analog signal at that instant (discrete values). In common video jargon, this is the frame rate of the audio. An inadequate sampling frequency leads to distortion and noise. Needless to say, larger values of bit depth and sampling frequency lead to better quality audio. If the Illustrative Graph was an actual analog to digital conversion, it would result in extremely poor quality audio as the samples are infrequent, and the bit values are few and far apart. For a more realistic (but still not very good quality) example, take a look at the 4-bit sampling graph on the previous page.
Nyquist-Shannon Sampling Theorem
Remember when we said that an ‘adequate’ sampling rate is required for effective analog to digital conversion? That is intuitively obvious, but this fundamental theorem lets us know exactly how much is ‘adequate’. The Sampling Theorem, as it is commonly known, provides us the conditions necessary for A/D conversion such that no information is lost. This only applies to a finite bandwidth, but nature has taken care of that for us by putting limits on our hearing. The average human ear can hear from 20Hz to 20KHz so that is our bandwidth. According to the Sampling theorem, we can safely and reliably encode any analog signal within 20KHz as long as we use a sampling rate that is 40KHz or more. Of course, there is more to the theorem than that, and it also provides a formula for reconstructing the analog wave from samples, but the key takeaway is that the sampling rate (Nyquist rate) should ideally be double the bandwidth limit (Nyquist Frequency) of the analog signal. Have a look at Nyquist’s Sampling Theorem for an intuitive understanding. A link for the mathematically inclined: http://dgit.in/SignSys
Digital to Analog (D/A) conversion
DAC are electronic devices that perform the reverse function of ADCs. ADCs are only required while recording the audio but once it is stored digitally, it can be easily manipulated, enhanced, and most importantly, copied and transferred across the internet. DAC chips are present in every audio playback device that is capable of playing digital audio, from your mobile phone to your console.
A DAC takes as input a series of finite precision values and outputs a continuous time varying signal (which is usually voltage). In practice, the output of the DAC is a step function and a reconstruction filter is applied to it, to return it to its original analog form.
Music is never digital, it is only stored digitally. If you’re wondering what literal digital music may sound like, think chiptunes, the original electronic music. Although, even that is analog by the time it’s played by the speaker, strictly speaking. Just that it’s the analog waveform that looks a lot like a digital waveform. Confused? Time for examples!
For the sake of illustration, let us consider this Digital Discourse the analogue of analog sound/music. Naturally, it follows that the typeset text you see here is the analogue of what you hear, which we shall call Analog text. What it has in common with sound is that between its production and consumption, it passes through electronic technology, and therefore must get Digitized (pun intended). Therefore, the letters you are now reading printed on paper once existed merely as some sequence of 0s and 1s in the ASCII format… Digital text. Now consider the following bit sequence:
01000100 01101001 01100111 01101001 01110100
Is this Analog text or Digital text? Even though it is digital in content, it is analog in form. In other words, it is an Analog representation of Digital text. Thus, we conclude, it is Analog text. Now, can you guess what it says?
We can’t say for sure that Apple’s decision to go “all digital” was motivated by concerns about the direction of audio technology. It may just be a disguised marketing tactic to tout the expensive AirPods (which look especially prone to getting lost). While it does excel at convenience as a Bluetooth headset with a lot of nifty features, removal of the 3.5 mm jack had nothing to do with it. Apple going “all digital” has not helped audio technology sound better in any way, although to be fair they have helped it hear better (one of their nifty features is the noise cancellation algorithm in the AirPod mics). However, being a major player, Apple’s decision may influence other manufacturers to go the all-digital way. This can be a good thing as long as manufacturers continue to enhance their wireless codecs or more of them continue to adopt technologies like Kleer and AptX.
For the audio industry, digital sound has been a blessing and a curse. Though the digital format offers advantages like unlimited accurate reproduction of original copies and near effortless worldwide distribution, this also brings with it a horde of security and policy headaches like piracy protection and Digital Rights Management. So which side wins the Analog vs Digital audio war? As far is sound quality is concerned, for all practical purposes, it is impossible to say which is better, analog or digital. In individual test cases what is most important is the quality of the recording and playback components, not whether it is analog or digital. For both types of audio signals, one can outperform the other as the equipment gets more expensive and elaborate to offer higher fidelity. Loudspeakers will always need analog signals, and the best way to store auditory information will always be digital. Either way, there’s an upper limit to the quality that a human ear can differentiate, so it matters not which is best. What matters most is if it is good enough.
This article was first published in November 2016 issue of Fast Track on Digit magazine. To read Digit’s articles first, subscribe here or download the Digit app for Android and iOS. You could also buy Digit’s previous issues here.