Understanding Digital Audio

Revision as of 16:13, 9 March 2015 by Meambobbo (talk | contribs) (Basic Principles)

Revision as of 16:13, 9 March 2015 by Meambobbo (talk | contribs) (Basic Principles)

Digital Audio is the representation of sound waves digitally.

Basic Principles

The most basic way to think of digital audio is like animation or video. By playing a number of individual "frames" quickly enough, it gives the appearance of motion. In the case of audio, the frames are called samples. Unlike video, however, digital audio is not an illusion - the digital representation of the sound is capable of storing all the information contained in and can be converted back into identical sound waves, at least theoretically.

The amount of information a digital audio signal can represent is determined by the bit depth and the sample rate. Bit depth is the number of bits per sample. Each sample represents the amplitude of the sound wave at that point in time. The higher the bit-depth, the more distinct values are possible for each sample, allowing more and more accuracy in recording. If the bit depth is significantly low, the values for each sample will be quite "off" from the analog wave. When such digital audio is converted back to analog, the resulting waveform will have a significant difference from the original. This is called quantization distortion, and it can result in increased noise and added frequencies in addition to simply loss of fidelity. Sometimes this effect is used purposefully (usually in electronic music), referred to as bitcrushing.

The number of samples per unit of time is called the sample rate, typically represented in kHz, which is the number of thousand samples per second. The sample rate determines the highest frequency that can be accurately represented, which is called the Nyquist Frequency, occurring at half the sample rate. With a 44.1 kHZ rate, the highest-representable frequency is 22.05 kHZ, which is roughly the maximum frequency that humans are capable of hearing. Typical values are 16-bit/44.1 kHZ (used on typical consumer CD's) and 24-bit/96 kHZ (for commercial recording). Each frequency above the Nyquist frequency is digitized identically to one below the Nyquist frequency. Similarly, when the digital signal is converted to analog, each frequency represented digitally will produce additional frequencies above the Nyquist frequency. These "phantom" frequencies that are produced by analog-to-digital (A>D) and digital-to-analog conversion are called aliases and their creation is called aliasing. A>D and D>A converters use low-pass filters to remove frequencies above the Nyquist frequency to prevent aliasing.

While digital audio is theoretically capable of perfectly representing analog sound, in practice, devices can inaccurately measure amplitude or mis-time a sample. The quality of such devices is paramount to accurate recording and reproduction of sound. Commercial audio production uses bit depths and sample rates higher than the final mastered product to ensure any error is minimized. While there is no need for frequencies between 22.05 kHZ and 48 kHZ (as no human can hear them), the higher sample rate prevents signal degradation as digital audio streams are manipulated and mixed together.

What has driven digital audio to completely replace analog formats in both the production and consumer side of the music industry? The best answer is its ability to be copied infinitely without any loss of quality. Recorded takes can be copied, sliced up, rearranged, manipulated, mixed-down, etc. without worry of any loss of quality. Record companies can distribute the master copy of an album to consumers without any degradation as it is transferred to a physical medium. It has also reduced costs. The price of transferring a compressed audio file from a server to a home computer is miniscule while transferring data to and from magnetic tape reels or creating plates to press vinyl records is not. Similarly, rather than having to record each take in a recording studio on expensive high-quality magnetic tape that would degrade in quality with erase and rewrite operations, recording audio digitally onto a hard drive is virtually cost-less. There's also no time costs in terms of rewinding, erasing, etc. - computers manipulate digital data almost instantaneously.

File Formats

Digital audio can be represented by a number of different file formats, which mainly pertain to the compression scheme they use (or at least support), as well as additional features such as Digital Rights Management (DRM).

Compact Discs or CD's stored LPCM audio at a set format. This means every CD player expected uncompressed audio with a bit depth of 16 bits and 44.1 kHz sample rate. Digital audio eventually expanded far beyond this medium, and players and software became smarter and more varied as far as what kinds of audio they could play.

It's important to understand that file formats do not necessarily indicate the exact codec used to encode the audio they contain. They are best thought of as containers, with a defined header format. This allows various software to know how to extract the header information, where to find the audio data in the file, and how to decode it. A codec is what is actually used to encode or decode the audio. Most audio player software has its own codecs, while some can refer to external software. Most file formats are limited, however, to support only a few codecs. Thus, it is common to associate compression/encoding schemes with file formats.

Compression uses various techniques to reduce the file size of digital audio. The main concern with compression is whether it noticeably degrades the audio signal - many schemes result in a loss of quality, known as lossy compression. Such compression is based upon human perception - reducing detail in places that it is least likely be noticed. Of course, different implementations may be more noticeable than others; and many feature different settings, allowing trade-offs between the compression ratio and quality of audio.

Lossless compression, on the other hand, results in no signal degradation, and the file can be converted back and forth from compressed and uncompressed formats without any change in the sample data. Compared to lossy compression, it typically features a much smaller compression ratio, and thus results in larger file sizes.

Digital Rights Management (DRM) refers to various methods that attempt to restrict decoding media files to authorized devices/users, preventing unlicensed file sharing and piracy. Many web stores still use forms of DRM, although it is now less common for music. DRM typically only allows playback through approved devices and software. No standardized, cross-brand DRM scheme was ever adapted, leading to significant consumer frustration. At the same time, most schemes were easily defeated. Thus, most of the music industry abandoned its use around 2009.

The main formats for storing uncompressed audio are .wav (for MS Windows), .aiff (for Apple Mac), and .au (Java, Unix). The primary lossy compression formats are .mp3, .m4a, .ogg, .aac, and .wma. A popular lossless file types is .flac. Windows media audio (.wma) supports both lossy and lossless encoding; however, it is generally assumed to use the lossy codec. .m4p and .wma are the primary formats of DRM-enabled audio files - iTunes switched from .m4p to .m4a files when it stopped using DRM. Almost all of these file types are capable of additional audio formats; however, these are their most common usages, and you can assume the type of audio contained in the file from the file type.

DAW softare typically works exclusively with uncompressed audio files. Each DAW may have encoders to create various file types with various encoding during rendering or bouncing, and you may be able to import other formats into a project; but internally the DAW will prefer to work with raw audio data. Imported audio is converted to uncompressed formats and stored as such. This prevents it from devoting resources to encoding or decoding audio unnecessarily.