Understanding Audio Quality: Bit Rate, Sample Rate, and Bit Depth

Blog / Python · September 28, 2015 · Updated June 10, 2026 · 9 min read
Understanding Audio Quality: Bit Rate, Sample Rate, and Bit Depth

Audio quality is governed by three numbers: sample rate, bit depth, and bit rate. Sample rate (in hertz) sets the highest frequency you can capture — by the Nyquist theorem, the maximum is half the sample rate. Bit depth (bits per sample) sets the dynamic range, roughly 6 dB per bit. Bit rate (in kbps) is how many bits represent each second of audio; for uncompressed PCM it equals sample rate × bit depth × channels. Compressed formats then trade some of that data for smaller files using lossless or lossy codecs.

Key takeaways

  • Sample rate = samples per second (Hz). The Nyquist theorem means the highest frequency you can record is half the sample rate, so 44.1 kHz captures up to 22.05 kHz — just past the limit of human hearing.
  • Bit depth = bits per sample. Each bit adds about 6 dB of dynamic range: 16-bit gives ~96 dB (CD quality), 24-bit gives ~144 dB (production headroom).
  • Bit rate = bits per second of audio (kbps). For uncompressed PCM, bit rate = sample rate × bit depth × channels.
  • Lossless codecs (PCM, FLAC, ALAC) reconstruct the original bit-for-bit; lossy codecs (MP3, AAC, Opus, Vorbis) discard inaudible data for much smaller files.
  • CBR keeps a fixed bit rate; VBR spends more bits on complex passages for better quality at a similar average size.
  • In 2026, Opus is the best general-purpose lossy codec for streaming and voice, AAC dominates Apple and most streaming apps, and MP3 survives mainly for universal compatibility.

What is sample rate, and what does the Nyquist theorem say?

A sample is a single measurement of the audio signal's amplitude at one instant. The sample rate is how many of those measurements are taken each second, expressed in hertz (Hz) or kilohertz (kHz). At 44.1 kHz, the signal is measured 44,100 times every second.

The Nyquist–Shannon sampling theorem is the rule that ties sample rate to fidelity: to reproduce a frequency without distortion, you must sample at more than twice that frequency. Flipping it around, the highest frequency a given sample rate can represent — the Nyquist frequency — is exactly half the sample rate. Anything above that limit folds back into the audible range as false tones (aliasing), which is why converters apply an anti-aliasing filter.

Human hearing tops out around 20 kHz, so a sample rate just above 40 kHz is enough to capture everything we can hear. That is why 44.1 kHz (CD) and 48 kHz (video and broadcast) became standards. Production work often uses 96 kHz or 192 kHz — not because we can hear those frequencies, but to give filters and pitch/time processing extra headroom before the audio is downsampled for release.

Sample rate Bit depth Nyquist limit Typical use
8–16 kHz 16-bit 4–8 kHz Telephony, voice notes, speech recognition
44.1 kHz 16-bit 22.05 kHz CD audio, music distribution
48 kHz 24-bit 24 kHz Film, TV, video, broadcast
96 kHz 24-bit 48 kHz Music production, mixing
192 kHz 24/32-bit 96 kHz High-resolution mastering and archival

What is bit depth, and how does it set dynamic range?

Bit depth is the number of bits used to store each sample. More bits mean finer amplitude steps, which lowers quantization noise and widens the dynamic range — the gap between the quietest and loudest sounds a recording can hold.

The relationship is close to linear: each extra bit adds about 6.02 dB of dynamic range. So:

  • 16-bit96 dB — the CD standard, ample for finished music played back at home.
  • 24-bit144 dB — the production standard, giving engineers headroom to record quietly and process without audible noise creeping in.
  • 32-bit float — used inside digital audio workstations for effectively unlimited internal headroom, so intermediate gain changes never clip.

For delivery, 16-bit is almost always enough; the extra depth of 24-bit and 32-bit float matters most during capture, editing, and mixing.

What is bit rate, and how do CBR, VBR, lossless, and lossy differ?

Bit rate is how many bits are used to represent one second of audio, measured in kilobits per second (kbps). Higher bit rates carry more detail and produce larger files; lower bit rates save space and bandwidth at the cost of fidelity.

How the bits are allocated over time defines the encoding mode:

  • CBR (constant bit rate) uses the same number of bits every second. It is predictable, easy to stream, and the safest choice for live broadcast — but it wastes bits on silence and starves complex passages.
  • VBR (variable bit rate) spends more bits on busy moments and fewer on simple ones, delivering better quality for a given average file size. File size becomes less predictable, which is fine for downloads but trickier for some streaming setups.
  • ABR (average bit rate) is a middle ground that targets an average while allowing modest local variation.

Codecs split into two families:

  • Lossless — PCM (WAV/AIFF), FLAC, and ALAC reconstruct the original signal bit-for-bit. FLAC and ALAC compress to roughly half the size of WAV with zero quality loss.
  • Lossy — MP3, AAC, Opus, and Vorbis use psychoacoustic models to discard sound we are unlikely to perceive, reaching far smaller files at the cost of some fidelity.
Format / codec Type Typical bit rate Best for
PCM (WAV/AIFF) Lossless, uncompressed ~1,411 kbps (CD) Mastering, editing, archival
FLAC Lossless, compressed ~700–1,000 kbps Archival, audiophile downloads
ALAC Lossless, compressed ~700–1,000 kbps Apple lossless libraries
MP3 Lossy 128–320 kbps Universal legacy compatibility
AAC Lossy 128–256 kbps Apple, YouTube, streaming apps
Opus Lossy 32–256 kbps Modern streaming, WebRTC, voice
Vorbis (OGG) Lossy 96–320 kbps Open-source apps and games

How do you calculate bit rate and file size?

For uncompressed PCM, bit rate is just the raw data per second:

bit rate = sample rate × bit depth × channels

A CD (44,100 Hz × 16 bits × 2 channels) works out to 1,411,200 bps ≈ 1,411 kbps (~1.41 Mbps). At 48 kHz the same 16-bit stereo stream is 1,536 kbps (~1.54 Mbps).

File size follows directly. For uncompressed audio:

file size (bytes) = (sample rate × bit depth × channels × seconds) ÷ 8

One hour of 16-bit, 44.1 kHz stereo is about 605 MiB (~635 MB). For a compressed stream you only need the bit rate and duration:

file size (bytes) ≈ (bit rate in bits per second × seconds) ÷ 8

So one hour at 128 kbps is about 57.6 MB, and at 320 kbps about 144 MB — a fraction of the uncompressed size, which is exactly why lossy codecs power streaming.

Which audio codec should you choose in 2026?

There is no single winner — pick the codec that matches the job:

  • Opus is the best general-purpose lossy codec today. It is royalty-free, scales from low-bandwidth voice to transparent music, and is the default for WebRTC, Discord, and much of YouTube. Choose it whenever you control both ends of the pipe.
  • AAC is the safe streaming default. It outperforms MP3 at the same bit rate and is natively supported across Apple devices, browsers, and most streaming apps.
  • MP3 is no longer the best at anything, but its universal compatibility (and now-expired patents) keep it everywhere. Use it only when you need a file that plays on literally any device.
  • FLAC / ALAC are the choice when you must preserve quality exactly — masters, archives, and audiophile downloads.

If you are delivering audio over a network, the codec is only half the story; the transport matters too. See our companion guides on Ogg, MP3, and AAC streaming protocols and on RTMP and MMS streaming protocols for how these formats actually reach listeners.

How do you convert audio with ffmpeg?

ffmpeg is the standard command-line tool for changing an audio file's codec, bit rate, sample rate, or bit depth. A few practical recipes:

# Re-encode to AAC at a fixed 192 kbps (good streaming default)
ffmpeg -i input.wav -c:a aac -b:a 192k output.m4a

# Re-encode to Opus at 96 kbps (excellent quality-per-byte)
ffmpeg -i input.wav -c:a libopus -b:a 96k output.opus

# Variable bit rate MP3 (-q:a 2 is roughly 190 kbps average, high quality)
ffmpeg -i input.wav -c:a libmp3lame -q:a 2 output.mp3

# Downsample to 44.1 kHz, 16-bit PCM for a CD-ready master
ffmpeg -i input.wav -ar 44100 -sample_fmt s16 -c:a pcm_s16le cd_master.wav

# Compress to lossless FLAC (about half the size, no quality loss)
ffmpeg -i input.wav -c:a flac output.flac

# Inspect a file's sample rate, bit depth, and bit rate
ffprobe -v error -show_streams -select_streams a input.wav

Need to build audio pipelines, transcoding services, or streaming features into your product? Our Python development team builds media tooling around ffmpeg and modern codecs.

Frequently Asked Questions

What is the difference between bit rate, sample rate, and bit depth?

Sample rate is how many times per second the audio is measured (in Hz); bit depth is how many bits each measurement uses, which sets dynamic range; and bit rate is how many bits represent one second of finished audio (in kbps). Sample rate and bit depth describe how the sound was captured, while bit rate describes how much data the stored or streamed file uses.

What does the Nyquist theorem mean for sample rate?

The Nyquist–Shannon theorem states that to reproduce a frequency accurately you must sample at more than twice that frequency. The highest frequency a sample rate can represent is therefore half the sample rate. Because human hearing ends near 20 kHz, a 44.1 kHz sample rate (Nyquist limit 22.05 kHz) is enough to capture everything we can hear.

Is a higher bit rate always better?

Not always. Beyond a certain point the extra data is inaudible: a well-encoded 256 kbps AAC or 128 kbps Opus file is transparent to most listeners, so jumping to 320 kbps mainly adds file size. Higher bit rates matter most for lossy codecs at low settings, for archival, and when audio will be re-edited; for final listening, moderate bit rates are usually enough.

What is the difference between CBR and VBR?

CBR (constant bit rate) uses the same number of bits every second, which makes file size and streaming predictable but wastes bits on quiet sections. VBR (variable bit rate) allocates more bits to complex passages and fewer to simple ones, giving better quality for a given average file size at the cost of less predictable sizing. CBR suits live streaming; VBR suits downloads and on-demand files.

What is the difference between lossless and lossy audio?

Lossless codecs such as PCM, FLAC, and ALAC reconstruct the original recording bit-for-bit, so there is no quality loss — FLAC and ALAC just compress the data to roughly half the size. Lossy codecs such as MP3, AAC, and Opus permanently discard sound deemed inaudible to reach far smaller files, which is why they dominate streaming where bandwidth matters more than perfect fidelity.

Which audio codec is best for streaming in 2026?

For most cases Opus is the best lossy codec because it is royalty-free and delivers excellent quality from low-bandwidth voice up to music; it is the default for WebRTC and much of YouTube. AAC is the safe broad-compatibility choice and dominates Apple and streaming apps, while MP3 remains useful only for universal device support. Use FLAC or ALAC when you need lossless quality.

Share this article