Sound becomes a pile of numbers depending on how many times per second you measure it (sampling rate) and how many bits you use for each measurement (bit depth). We start by calculating the size of uncompressed PCM.
Video has frames; sound has samples. Digital audio is what you get when you read the continuous voltage change from a microphone at very short intervals and write each reading down as a number. It is the same idea as pixels and bit depth in Chapter 1, except you slice once along the time axis and once along the amplitude axis.
The sampling rate is the number of samples per second (Hz). According to the sampling theorem (Nyquist–Shannon), you can reconstruct frequencies up to half the sampling rate. Human hearing is usually taken to span 20 Hz to 20 kHz, so to capture 20 kHz you have to sample at more than 40 kHz. That is the background to music CDs using 44.1 kHz and video and broadcast using 48 kHz as a de facto standard.
"Where you typically see it" reflects common practice. There are plenty of exceptions.
Video work is normally set to 48 kHz. If you drop 44.1 kHz audio onto a video as is, some editors and players resample it internally, and depending on the equipment the sound can drift out of sync or pick up noise. It is safer to convert only once, right before final output.
Bit depth is the number of bits used to record one sample. Each extra bit doubles the number of levels you can represent and widens the ratio between the quietest and loudest sound (the dynamic range) by about 6 dB. That is why 16-bit works out to roughly 96 dB and 24-bit to roughly 144 dB (number of bits × about 6.02 dB). The missing precision shows up as quantization noise, and in production, a faint noise called dither is sometimes mixed in to make that noise less objectionable.
The bitrate of uncompressed audio (PCM) is sampling rate × bit depth × number of channels. The values below come from that multiplication alone.
One minute of CD-quality audio is 1,411,200 ÷ 8 × 60 = 10,584,000 bytes, about 10.6 MB.
The uncompressed 4K video we calculated in Chapter 1 came to about 6 Gbps (5,970 Mbps). Even uncompressed, stereo audio is around 1.5 Mbps, which is nearly three orders of magnitude smaller than video. So the goal of an audio codec is less about "getting over a file-size cliff" and more about how clean the sound is at a given size, and how little delay it adds. The cost structure is different from the video codecs in Chapters 8–10.
ffprobe -v error -select_streams a:0 \
-show_entries stream=codec_name,sample_rate,channels,channel_layout,bit_rate \
-of default=noprint_wrappers=1 input.mp4Samples per second (Hz). The highest frequency you can reconstruct is half this value.
Half the sampling rate. Frequencies above it cannot be captured correctly.
The number of bits used to record one sample. The larger it is, the wider the dynamic range (about 6 dB per bit).
Recording sample values as they are, with no compression. WAV and similar formats are in this form.
Noise produced by the error from snapping continuous values to a fixed set of levels.
What is the bitrate of 48 kHz, 16-bit, stereo PCM audio?