Introduction

A three-minute song in uncompressed CD quality weighs about 30 MB. The same song in MP3 at 128 kbps weighs about 3 MB. Both sound, to most listeners, essentially identical.

That factor-of-ten miracle is not just clever arithmetic. It rests on a property of your own auditory system: a loud sound makes nearby quieter sounds inaudible, even if they are physically present in the signal. This phenomenon is called auditory masking, and it was understood by psychoacousticians long before the digital age.

The engineers who designed the MPEG Audio Layer III standard in the late 1980s and early 1990s asked a radical question: what if we simply did not encode the parts of a signal that the ear cannot hear anyway? If a sound is masked — drowned out by a louder neighbor — its absence causes no perceptible distortion. Throwing it away is lossless from the listener's point of view, even though it is lossy in the mathematical sense.

This idea, called perceptual coding, is what separates MP3 from a zip file. A zip file preserves every bit exactly. MP3 discards bits strategically, guided by a model of human hearing, and bets that you will never miss them.

Watch Masking Live

The bar chart below shows 32 frequency bands, like the subbands an MP3 encoder divides audio into. Drag the slider to move a loud masker tone across the spectrum, or adjust its level. The red bars show the masking threshold — any quieter signal below that threshold (gray bars) would be inaudible and can be discarded by the encoder.

<!-- {{c_html_intro}} -->
<p class="hint">{{hint_para}}</p>
<div class="controls">
  <label>{{label_masker_pos}} <span id="pos-val">16</span>
    <input type="range" id="masker-pos" min="0" max="31" value="16" step="1">
  </label>
  <label>{{label_masker_level}} <span id="lvl-val">80</span> dB
    <input type="range" id="masker-level" min="40" max="96" value="80" step="1">
  </label>
</div>
<div class="chart-wrap">
  <canvas id="chart" width="660" height="260"></canvas>
</div>
<div class="legend">
  <span class="dot signal"></span> {{legend_signal}}
  <span class="dot mask"></span> {{legend_mask}}
  <span class="dot kept"></span> {{legend_kept}}
  <span class="dot cut"></span> {{legend_cut}}
</div>
<div id="status" class="status"></div>
<div class="btns">
  <button id="reset-btn" class="ghost">{{btn_reset}}</button>
</div>
/* {{c_css_intro}} */
* { box-sizing: border-box; }
body { font-family: system-ui, sans-serif; color: #222; margin: 0; }
.hint { font-size: .9rem; color: #444; margin: 0 0 .6rem; line-height: 1.45; }
.controls { display: flex; flex-wrap: wrap; gap: .5rem 1.2rem; margin-bottom: .5rem; }
label { font-size: .85rem; display: flex; flex-direction: column; gap: .15rem; color: #333; }
input[type=range] { width: 180px; accent-color: #1d3557; }
.chart-wrap { width: 100%; overflow-x: auto; }
canvas { display: block; max-width: 100%; }
.legend { display: flex; flex-wrap: wrap; gap: .3rem .8rem; font-size: .8rem;
          color: #555; margin: .4rem 0; align-items: center; }
.dot { display: inline-block; width: 10px; height: 10px; border-radius: 2px; }
.dot.signal { background: #4a90d9; }
.dot.mask   { background: #e63946; }
.dot.kept   { background: #57ab5a; }
.dot.cut    { background: #ccc; }
.status { font-size: .9rem; font-weight: 600; min-height: 1.4em; margin: .3rem 0; color: #1d3557; }
.btns { display: flex; gap: .5rem; }
button { font: 600 13px system-ui; padding: .4rem .85rem; border: 1px solid #1d3557;
         background: #1d3557; color: #fff; border-radius: 8px; cursor: pointer; }
button.ghost { background: #fff; color: #1d3557; }
// Code not found

Notice how the masking threshold is asymmetric: it spreads further toward higher frequencies than lower ones. This matches real hearing data. The encoder allocates bits only to bands whose signal energy rises above the threshold — bands hidden underneath get zero bits.

The Real Complexity

The psychoacoustic model is a solved, finished algorithm — not an open research problem. Here is what it actually does for each short frame of audio (roughly 26 ms):

  • Subband decomposition: the encoder splits the audio into 32 frequency subbands using a polyphase filterbank. Each subband's energy is measured.
  • Spectral analysis: a fast Fourier transform (FFT) of the same frame gives a finer frequency picture, used to locate tonal components (pure tones) and noise-like components separately.
  • Masking threshold computation: for each tonal and noise masker, the model computes a spreading function that describes how much the masker raises the hearing threshold in nearby bands. The individual contributions are summed to get a global masking threshold T(b)T(b) for each subband bb.
  • Signal-to-mask ratio (SMR): the ratio of the subband's actual energy E(b)E(b) to its masking threshold T(b)T(b). Bands with a high SMR need many bits; bands where E(b)<T(b)E(b) < T(b) need zero.
  • Bit allocation: bits are distributed iteratively across subbands until the quantization noise in each band falls below T(b)T(b). This inner loop is O(B2)O(B^{2}) in the number of subbands B=32B = 32, fast in practice.

The whole model runs in real time on hardware that was slow by today's standards. Its computational cost is dominated by the FFT — O(NlogN)O(N \log N) per frame — and the bit-allocation loop, both cheap enough to run faster than playback speed even on a 1993 PC.

The standard (ISO/IEC 11172-3, published 1993) leaves the psychoacoustic model as a recommendation, not a mandate — encoders compete by tuning their models. But the mathematical structure is fixed: measure energy, compute thresholds, allocate bits, quantize, pack.

Where It Matters

Perceptual coding built the modern media landscape. Every format you encounter relies on the same masking insight:

  • Music streaming: Spotify, Apple Music, and YouTube all serve AAC or Opus files — direct descendants of the MP3 masking model, with better bit-allocation algorithms.
  • Video audio tracks: Dolby AC-3 (the audio in most DVDs and cinema prints) and DTS both use perceptual models closely related to ISO 11172-3.
  • Voice and video calls: the Opus codec (used in WebRTC, Discord, WhatsApp) applies a simpler masking model tuned for speech — discarding masked components lets calls sound clear at as little as 6 kbps.
  • Spatial audio: modern formats like Dolby Atmos encode dozens of audio objects by exploiting both spectral masking and temporal masking (a loud sound briefly masks quieter sounds that follow it by a few milliseconds).
  • Hearing research: the models built for MP3 became precision tools for audiologists. Devices that measure auditory masking thresholds in clinical settings use the same spreading-function mathematics.

Learn how MP3 masking works and you understand the engine under virtually all compressed audio — a direct line from information theory and the physics of perception to the earbuds in your pocket.

Conclusion

MP3 is a story about exploiting a limitation. Your auditory system evolved to extract useful signals from a noisy world, and in doing so it developed blind spots — frequency bands that a loud neighbor renders temporarily inaudible. The MPEG engineers turned those blind spots into storage.

The core idea is simple enough to state in a sentence: encode only what the listener can actually hear. But applying it required a careful model of human perception, a clever bit-allocation algorithm, and the courage to build a format that is mathematically lossy yet perceptually lossless.

That trade-off is now everywhere — in every stream you play, every call you make, every movie you watch. And it all traces back to the masking threshold, a curve drawn not by mathematics alone but by the shape of human hearing itself. See also compression for the broader story of what we throw away and why.

Share this article

Pick a channel — or use your device's native share sheet.

Comments

Loading comments...

https://www.kipuhub.com/en/article/mp3-psychoacoustics/Content licensed under CC BY-NC 4.0.