Tuesday, October 31, 2017

Does my phone have a DAC? Explaining DACs and Amps in smartphones today

Everything you wanted to know about smartphone audio but are too afraid to ask.

We get this question a lot, and now that so many phones no longer have a headphone jack, it's even more common: Does my phone have a DAC? What exactly is a DAC and what does it do? What about an amp?

Let's see if we can figure out the answers and, more importantly, make some sense of how this all works and why we need this DAC thing with its funny name and how an amp makes it sound better or worse.

More: The state of smartphone audio: DAC, codecs, and other terms you need to know

What is a DAC?

Image courtesy of LG.

A DAC takes a digital signal from its input and converts it into an analog signal on its output. A digital audio signal is easy to explain but a little harder to wrap your head around. It's an electrical signal that's converted into bits. The bits are in a pattern that has a specific value at each point, and the more times the original signal was sampled, the more precise this pattern and those values are.

An analog signal is what you picture in your head when you think of a waveform. It's a continuous signal that varies in amplitude along a timeline.

Audio is converted into a digital copy because it's easier to compress and the electronic things we love, like our phones, can't store an analog signal like a tape can. They also can't read one back, in case you were thinking about attaching a tape-drive to your phone. A digital signal is very different from an analog signal, and the easiest way to understand this is a handy little diagram.

The digital signal follows very rigid and calculated lines, while the analog signal is more freeform. This is because of the sample times; more sample times would be closer together along the bottom axis (TIME) and make a smoother digital signal that's closer in shape to the analog. The right axis measures the amplitude of an audio wave. When you see the signal between the third and fourth sample time in our example, you can see how the two signals are different, which means the sound produced will be different.

Physics and the limitations that come with being human means that this isn't as important for playback as it appears. But it's very important for studio work and preserving the original quality of a recording. Conversion is a very complex procedure and a DAC does a lot of work. What's important is to recognize why a digital audio file may sound different from an analog recording.

The amp

An amplifier only does one thing — drives an analog signal (the amps we're talking about, anyway) so it's more intense and will be louder when it comes out of a speaker. An analog signal is just electricity. Boosting electricity is really, really easy and you use what amounts to a transformer (settle down engineers, this needs to be simple) to take the input, grab some power from elsewhere, and crank the input up. It transforms the source.

Building an amp is easy. Building a good amp isn't.

A few specifics can show the easy part. To amplify a fluctuating signal — like any kind of audio — you use a three-wire component called a transistor (or its equivalent in an integrated circuit). The three connections are called the base, the collector, and the emitter. Feeding a weak signal between the base and the emitter creates a more intense signal across the emitter and the collector when provided with external power. The original signal is attached to the base and the speaker is attached to the collector. You can do the same with a vacuum tube but that's not going to fit inside your phone.

The hard part is doing all this while maintaining the original frequency and amplitude. If the amp can't reproduce the frequency of the input signal, its frequency response isn't a good match and some sounds get boosted more than others and everything sounds bad. If the input amplitude (let's call that volume) increases to a level that the output can't match (a transistor can only output so much power), the volume from the amp levels off and your sound starts clipping and distorting. Finally, if you're listening while recording (we used to call that a phone call), an amp has to be careful it doesn't boost the signal high enough for the microphone to pick it up or you'll get feedback. This doesn't apply to just the output you can hear, but the signal itself. Electricity = magnetism.

A quality amp can mitigate all the distortion it creates.

When you're talking about big amps that are used on stage there are a lot of other things in the mix like pre-amps or multistage amps or even complicated op-amp setups that can affect the sound. But small amps have their own difficulties if you want to make a good one, too. You can't boost an analog signal without affecting the gain (volume), fidelity (faithful sound reproduction), or efficiency (battery drain). Making a good amp for a phone is hard. Way harder than using a good DAC, which is why we see phones with a good 24-bit DAC that still sound poor when compared to a phone like the LG V30.

Bit depth and sampling rates

We can't hear digital audio. But our phones can't store analog audio. So when we play our music, it has to pass through a DAC. Our little diagram above shows how important it is to sample an analog signal as many times as reasonably possible when converting it into a digital file. But how "deep" you sample makes a difference, too.

Without getting too technical, the more accurate you want each sample to be, the higher the bit depth you need to use. Bit depth is represented by a number that can be deceiving. The difference in size between 16 and 24 and 32 is more than you think. A lot more.

When you add one bit, you double the amount of data patterns.

A bit can only store two values (0 and 1), but you can count using them just like you can with "regular" numerals. Start counting at 0 and you hit 9; you add another column to the number and get 10. Using bits, you start at 0 and when you hit 1 you add another column to get 00 which becomes a 2-bit number. A two-bit number can have four different data patterns or points (00, 01, 10, or 11). When you add a single bit, you double the number of data points and a 3-bit number can have eight different data patterns (000, 001, 010, 011,100, 101, 110, or 111).

Don't worry. We're done with math. It's just important to understand what the bit depth really represents. A 16-bit signal has 65,536 separate data points, a 24-bit signal has 256 times more data with 16,777,216 points per sample, and a 32-bit signal has 4,294,967,294 points per sample. That's 65,536 times more data than a 16-bit file.

Sample rates are measured in Hertz, and 1 Hertz means one time each second. The more times you sample a file, the more of the original data you can capture. CD-quality audio encoding captures data at a rate of 44,100 times per second. High-resolution encoding can realistically sample at 384,000 times per second. When you capture more data with a higher bit depth and do it more times per second, you can recreate the original more accurately.

Building a good DAC and amp isn't the only complicated part of the process - encoding audio uses millions and millions of calculations every second.

These same factors matter for streamed audio (which is digital) as well but streamed audio adds another layer of complication because it's quality also depends on bitrate — bits processed per unit of time. We measure this the same way we measure internet speeds: kbps (kilobits per second). Higher is better. The codec used to compress a digital audio signal is also important, and lossless codecs like FLAC or ALAC keep more of the digital data that lossy codecs like MP3. A lot of work is involved to make sound come through your speaker or headphones.

Real-world numbers

We mentioned earlier that encoding a recording for storage (as a master) is a bit different than encoding it for playback. Machines and computers can't hear, and this is all a numbers game. When you encode and decode an audio signal, you're doing a lot of math. The more information you use to calculate the amplitude of a signal, the more accurate the calculations will be. But our ears are not computers.

Even perfect hearing won't help you hear any benefit from a 32-bit sudio system. For now, anyway.

An audio file is filled with "sounds" that we can't hear. Most of the data in a 32-bit encoding is of no use when listening, and a sample rate that's too high can actually sound worse because it introduces too much electrical noise. Producing a digital audio file that holds the right amount of information takes this into consideration, as does the design of a DAC. But like all things, higher numbers look better to the people who market them. Knowing the how and why all this works is really cool, but knowing what you need is more important.

A digital audio file encoded at 24-bits and 48kHz, and a DAC that can convert them offers the best quality we can hear. Anything higher is a placebo and a marketing tool.

The physical limits of our bodies and the way our current tech works mean data collected at a bit depth greater than 21-bit and sampled more frequently than 42kHz are the limit of "perfect" hearing. It's important to have a digital copy of recorded audio at extremely high data rates in case there's a technological breakthrough, but the files you listen to and the hardware that plays them back has a reasonable ceiling. But that breakthrough will never happen with hardware we use today, so that 32-bit DAC in your LG V30 is a lot of overkill.

So, let's go through this DAC and amp thing again

A DAC is an audio component that is used to turn the digital audio files stored on our phones into an analog signal. There is a lot of complicated math involved that tries to make the copy of a copy sound close to the original, but much of the audio data is something we can't hear. You can even make things sound worse if you try to do too much when encoding a file.

An app plays the file. A DAC converts it to analog. The amp boosts the signal. And the cheese stands alone.

An analog signal is fed into an amp that boosts the signal's intensity so it gets louder. But making things louder without making them sound bad is very hard. When you're doing it on something as small as a phone which also has a limited amount of battery power it becomes especially complicated. The amp can (and usually does) have more impact on how things sound to our ears than the DAC does.

The analog output from the DAC and amp is something that our headphones can play and our ears can hear, but our phones can't properly store one, so a digital file is needed. And in case an engineer somewhere makes a significant breakthrough in digital audio encoding and decoding, original works are stored with astronomical amounts of data, much of which gets thrown out when encoding a file that sounds best.

All you ever need is a DAC that can convert 24-bit/48kHz files, an amp that boosts the signal without adding distortion or noise, and high-quality files to play.

Whew.

Does my phone have a DAC and an amp?

Does it make any sounds at all? If so, it has a DAC and an amplifier.

We talked about why recorded audio is converted to a digital copy earlier, but what about an analog signal? Why is it special and why do we have to convert audio back to analog? Because of pressure.

Every electronic thing that can play sounds has a DAC.

One way to measure an analog signal is by its intensity. The more intense (further away from the zero spot in a waveform) each frequency in a signal is the louder it will be when recreated by a speaker. A speaker uses an electromagnet and paper or cloth that moves to convert the signal into sound. The analog signal keeps the coil moving and the paper or cloth elements push the air to create a wave of pressure. When this pressure wave reaches our eardrums it makes a sound. Vary the intensity and frequency of the pressure waves and you create different sounds.

It almost seems like magic, and the scientists who figured out how to record and playback audio were on a whole 'nother level of smart.

A DAC and amp can live happily ever after in your headphones or a cable.

Some phones have a better DAC and amp than others, and phones without a headphone jack don't have to use a DAC/amp combo to send audio to a pair of headphones. All phones have them for system sounds and voice calls, but a DAC and amp can also live inside your headphones or even in the cable that connects headphones to your USB port. USB-C can send analog and digital audio out and both regular headphones (with an adapter) can be used to play analog audio from the port and headphones with their own DAC can receive digital audio to decode and convert themselves.

And you probably have headphones with a DAC and amp inside them, because that's how Bluetooth works.

Bluetooth audio

A DAC and amp have to sit inline between the digital file being played and your ears. There's no other way we can hear any sounds. When we use Bluetooth to listen to music or a movie (or even a phone call) we're sending a digital signal out from our phone and into our Bluetooth headphones. Once there, it's converted on the fly (that's what audio streaming means) into an analog signal, routed through the speakers and carried through the air as a pressure wave to your ears.

Bluetooth adds another layer of complication into the mix, but there is still a DAC and amp involved.

The quality of a DAC and amp when using Bluetooth is just as important as it is with a wired connection, but other components can affect the sound, too. Before audio is sent through Bluetooth, it gets compressed. That's because Bluetooth is slow. A smaller chunk of a file is easier to send than a larger one and compressing audio makes it easier to stream. When the chunk of a compressed audio file is received by your headphones it must first be decompressed then sent in the right order through the DAC and amp in your headphones. There are several different ways to compress, chop up, transfer and reassemble audio over Bluetooth using different Bluetooth audio codecs. Some bring a better digital file (a higher bit depth and sample rate) than others to your headphones' DAC and amp, but once that data arrives your Bluetooth headphones work exactly the same way an internal DAC and amp do.

A summary and what matters

There are a lot of ways to get music from a song you downloaded on your phone out to your ears. But every single one of them requires a DAC and an amp.

You don't have to be an audiophile to enjoy listening to music. What matters is how it sounds to you.

High-end audio components can process more audio data and offer better sounding audio, but everything in life has a trade-off. A DAC that can convert more than 16-bit audio is more expensive to buy and incorporate into a phone because it's also more sensitive to interference from other parts. The same goes for an amp — especially powerful amps that can drive high-impedance headphones. Even the audio files themselves have a drawback, as "hi-res" audio files can be quite large and take more storage space or a faster connection to stream.

You really don't have to know any of this to like the way your phone sounds. And that's the key — you are the one who decides what sounds good. Don't let any discussion about what's best or what's wrong with Bluetooth influence what you hear, especially if you are happy with how it sounds.



from Android Central - Android Forums, News, Reviews, Help and Android Wallpapers http://ift.tt/2xGWW1k
via IFTTT

No comments:

Post a Comment