# MP3
**MP3**, formally MPEG-1 Audio Layer III, is a lossy audio [[Codec|compression format]] that removes the parts of a recording a listener is least likely to hear and spends its remaining bits on the rest, shrinking a music file to roughly a tenth the size of the uncompressed original while leaving most listeners unable to pick the difference in a casual listen. The primary microsim on this page recreates the psychoacoustic core of that trick: it draws the masking threshold a single loud tone raises around itself and lets the reader watch a handful of quieter test tones cross in and out of audibility, and with them, in and out of the bits an encoder has to spend.
The format grew out of research into how the ear itself throws sound away long before it reaches conscious hearing, formalised into a standard during the early 1990s and left largely unchanged in its core design since. Its later history is less about the codec than about what a very good, very small audio file did once ordinary people had a network to move it across: file structure and bit-rate mechanics settled early, while licensing and the wider ecosystem of rival formats kept changing for two more decades.
## History
### Background
Compact-disc audio stores every sample at full resolution — 16 bits at 44,100 samples per second per channel, a rate chosen high enough to cover the range of human hearing under the [[Nyquist–Shannon_sampling_theorem|sampling theorem]] — and a few minutes of it already runs to tens of megabytes as plain [[Pulse-code_modulation|PCM]]. Long before networks made that a problem for ordinary listeners, telecommunications and broadcast engineers wanted the same audio over links with a fraction of that capacity, and psychoacoustic research going back decades had already shown that a loud sound raises the threshold of audibility for quieter sounds near it in frequency, so that a great deal of a full-resolution recording is, in a precise sense, inaudible.
### Development
The lead technical work on what became Layer III was carried out at the Fraunhofer Institute for Integrated Circuits in Erlangen, Germany, under Karlheinz Brandenburg, working with the University of Erlangen-Nuremberg.[^brandenburg99] The effort fed into a wider international standardisation process that combined several competing proposals for perceptual audio coding, among them contributions from AT&T's [[Bell_Labs|Bell Laboratories]], into the single layered design eventually adopted.[^mergeneeded]
### Standardization
The result was published as part of the first MPEG standard, which defined three layers of increasing complexity and compression: Layer I, Layer II and Layer III, the last being what almost everyone now simply calls MP3.[^iso11172] Each layer builds on the one below it and trades additional encoder complexity for a lower bit rate at equivalent quality, so Layer III needs the most computation but delivers the smallest files.
### Going public
#### Internet spreading
An MP3 file's [[Data_compression|compression]] made moving music over a dial-up modem practical for the first time, and by the mid-1990s ripped and encoded tracks were circulating on early file-sharing networks well ahead of any licensed way to buy the same files online. The unauthorised sharing of MP3s became one of the defining copyright disputes of the era, tested most visibly in litigation over a peer-to-peer service that let users search each other's collections directly.[^napster]
### Further versions
#### MPEG-2
A backward-compatible extension published a few years later added lower sample rates and support for more than two channels, including multichannel surround configurations, while decoders for the original standard could still play the simpler streams.[^iso13818]
#### MPEG-2.5
An unofficial further extension, never itself an ISO standard, added even lower sample rates for very low bit-rate, speech-like material; it originated at Fraunhofer and was adopted informally by encoder and decoder authors because the format's own frame header left room to signal it without breaking existing players.
### Internet distribution
Portable players built around MP3 decoding chips, and later general-purpose devices running MP3-capable software, made a personal music collection something a listener carried rather than sat next to, and the format's small size was central to a separate legal fight over whether a device that merely played such files, rather than distributing them, infringed anything at all.[^diamondrio] Licensed download and streaming services eventually arrived at commercial terms for the same format that unauthorised sharing had already made a de facto standard.
## Design
### File structure
An MP3 stream is a sequence of frames, each independently decodable, carrying its own header that states the MPEG version, layer, bit rate and sample rate, an optional checksum for [[Error_detection_and_correction|error detection]], side information the decoder needs to unpack that frame's data, and the compressed audio itself. Because each frame is self-describing, a player can begin decoding in the middle of a stream or after a byte has been lost, at the cost of that one frame's audio rather than the whole file.
### Encoding and decoding
The encoder splits the incoming signal with a 32-band polyphase [[Filter_bank]] inherited from the simpler Layers I and II, then refines each band's frequency resolution further with a [[Discrete_cosine_transform|modified discrete cosine transform]], giving a hybrid time–frequency representation.[^brandenburg99] In parallel, a psychoacoustic model, typically built on its own separate [[Fast_Fourier_transform|FFT]] analysis of the same input, computes how much quantisation noise each band can hide beneath the absolute threshold of hearing and the raised threshold that a loud, nearby tone casts across its neighbours. An iterative loop then chooses quantiser step sizes so the coding noise in every band sits just under that masking threshold while the whole frame still fits its bit budget, and the quantised values are packed with Huffman entropy coding to squeeze out the redundancy that remains. This auditory masking is a psychoacoustic effect and is distinct from the purely mathematical masking of a weak spectral line by a strong nearby one under a finite analysis window, though a real encoder's filter bank has to contend with both at once.[^tib100]
### Quality
Perceptual quality is a property of the bit rate and the specific encoder's psychoacoustic model together, not of the format alone: two encoders run at the same bit rate can sound noticeably different, and a poorly tuned one can produce audible pre-echo ahead of a sharp transient or a thin, metallic ringing on certain material even where a better-tuned encoder at the same rate sounds transparent. Because MP3 makes no assumption that its source is a human voice, unlike a dedicated [[Speech_coding|speech codec]], it performs consistently across music, speech and ambient recordings, and comparative listening tests of encoder quality were a recurring subject in the engineering press, including publications of the [[Institute_of_Electrical_and_Electronics_Engineers|IEEE]].
### Bit rate and sampling rates
MPEG-1 Layer III supports [[Sampling_(signal_processing)|sampling rates]] of 32, 44.1 and 48 kHz and a ladder of fixed bit rates from 32 to 320 kbit/s, with variable bit-rate modes that let the encoder spend more of that budget on difficult passages and less on easy ones for a steadier quality target than a fixed rate can give. Halving the sample rate roughly halves the audio bandwidth the format can carry, which is the trade MPEG-2's lower rates and MPEG-2.5's lower rates still make.
### Ancillary data
The frame format sets aside a small, optional block of ancillary data alongside the compressed audio in each frame, available to an encoder for anything it wants to carry alongside the sound itself; in practice the allowance saw only light, largely proprietary use before ID3 metadata took over the job of carrying information about a track.
### Metadata
The standard itself defines no metadata field for a track's title, artist or album; that gap was filled after the fact by ID3 tags, either a fixed short block appended to the end of the file or a more flexible, variable-length block prepended to its start, neither of which forms part of the audio decoding process itself and both of which a decoder is free to simply skip.
## Licensing, ownership, and legislation
For most of its commercial life, implementing an MP3 encoder or decoder required a patent licence from a pool jointly administered by Fraunhofer and Thomson (later Technicolor), covering techniques used in the encoding and decoding process; the per-unit and per-copy fees this required became a standing argument for the royalty-free alternatives described below. Separately, patents that trace back to Bell Labs research and passed through several owners produced a major infringement suit over MP3 decoding in general-purpose computers, contested through years of trial and appeal.[^altlucent] The dispute illustrated a recurring tension in the format's history: a design published through an open international standards process still carried private patent claims on pieces of its implementation, so that "playing an MP3" and "being licensed to play an MP3" were legally two different things for most of the format's popular life, even though the file format itself was openly documented. As the underlying patents expired through the 2010s, the format's original rights holders wound the licensing programme down.[^licenseend]
## Alternative technologies
Later perceptual codecs from the same MPEG lineage, chiefly Advanced Audio Coding, generally deliver better quality than MP3 at an equal bit rate, since they were free to abandon backward compatibility with the older Layer I and II filter bank. Outside the MPEG family, the Xiph.Org Foundation produced a royalty-free alternative from the outset, later followed by a codec standardised through the Internet Engineering Task Force that merges speech and music coding into one design tuned for low delay in real-time calls.[^opus] A separate lossless format compresses a recording without discarding anything a listener could ever hear, at a much smaller saving than any perceptual codec accepts in exchange for that guarantee, and research into coding schemes built on the [[Discrete_wavelet_transform]] rather than a cosine transform has continued without displacing MP3's installed base of players and encoded libraries. None of these alternatives eliminated MP3 the way MP3 itself displaced plain PCM distribution: a file format becomes hard to retire once enough decoders, encoders and encoded libraries already exist for it, regardless of how a newer design compares on a fresh technical comparison of quality against bit rate.
## Microsims
The primary sketch plots sound pressure level against frequency on a logarithmic axis from 20 Hz to 20 kHz. A fixed curve traces the absolute threshold of hearing, the quietest tone audible in silence, which is least sensitive at the low and high ends of the range and most sensitive around 3–4 kHz. A single adjustable masker tone adds its own raised threshold on top of that curve, spreading unevenly to either side in a domain where distance is measured in critical bands of hearing rather than in hertz. Six fixed test tones, spread from 180 Hz to 9,000 Hz, are drawn against the combined threshold and marked coded or discarded depending on whether they clear it, with a running count of how many are coded, their average margin above threshold, and an estimate of the bits that margin saves. Controls set the masker's frequency and level and a shared level shift applied to all six test tones together; an auto-sweep option walks the masker across the band on its own.
*Try:* At the sketch's own defaults, a 1,000 Hz masker at 78 dB SPL is too weak to bury any of the six test tones, and the sketch's own verdict says so; raise the masker level toward the top of its range and watch the tones above it, at 1,300 Hz and 2,600 Hz, disappear together once the masker passes about 86 dB SPL, while the tones below it at 520 Hz and 180 Hz stay clearly audible all the way to the slider's maximum — in the sketch, masking spreads further upward in frequency than downward.
A three.js companion built on the [[Filter_bank]] sketch renders the encoder's 32-band polyphase stage directly, the mechanical step that divides the spectrum into the bands this microsim's masking threshold is computed over.
## Wikipedia : Wikitube
**Strict pair:** [Wikipedia](https://en.wikipedia.org/wiki/MP3) : [Wikitube](https://en.wikitube.io/wiki/MP3)
Skeleton mirrored at revision 1372333180. Prose, emphasis and the microsims are Wikitube's own.
## See also
- [[Discrete_cosine_transform]]
- [[Filter_bank]]
- [[Data_compression]]
- [[Codec]]
- [[Pulse-code_modulation]]
- [[Speech_coding]]
- [[Fourier_transform]]
- [[Claude_Shannon]]
## References
[^brandenburg99]: Brandenburg, K. "MP3 and AAC Explained." *Proceedings of the AES 17th International Conference on High-Quality Audio Coding*, Florence, 1999.
[^mergeneeded]: Citation needed: primary MPEG standardization-committee record of how the Layer III proposals (including the ASPEC effort and its contributing laboratories) were merged into the final design.
[^iso11172]: International Organization for Standardization. *ISO/IEC 11172-3:1993, Information technology — Coding of moving pictures and associated audio for digital storage media at up to about 1.5 Mbit/s — Part 3: Audio*. 1993.
[^napster]: *A&M Records, Inc. v. Napster, Inc.*, Federal Reporter, 3rd series, vol. 239, p. 1004 (9th Cir. 2001).
[^iso13818]: International Organization for Standardization. *ISO/IEC 13818-3:1995, Information technology — Generic coding of moving pictures and associated audio information — Part 3: Audio*. 1995.
[^diamondrio]: *Recording Industry Association of America v. Diamond Multimedia Systems, Inc.*, Federal Reporter, 3rd series, vol. 180, p. 1072 (9th Cir. 1999).
[^tib100]: Tiberius, C.; Mulder, M. *Engineering Signal Analysis: From Fourier to filtering: Theory*. 2026, p. 100 (PDF page). Open Textbook Library: https://open.umn.edu/opentextbooks/textbooks/engineering-signal-analysis-from-fourier-to-filtering-theory . CC BY.
[^altlucent]: Citation needed: case citation and final disposition of the Bell-Labs-derived MP3 patent litigation against Microsoft.
[^licenseend]: Citation needed: Fraunhofer IIS/Technicolor's own statement ending the MP3 patent licensing programme (exact date and wording).
[^opus]: Internet Engineering Task Force. *RFC 6716, Definition of the Opus Audio Codec*. 2012. https://www.rfc-editor.org/rfc/rfc6716 .
## Further reading
- Tiberius, C.; Mulder, M. *Engineering Signal Analysis: From Fourier to filtering: Theory* (2026). Open Textbook Library: https://open.umn.edu/opentextbooks/textbooks/engineering-signal-analysis-from-fourier-to-filtering-theory
- Stiber, M.; Stiber, B.; Larson, E. *Signal Computing: Digital Signals in the Software Domain* (2020). Open Textbook Library: https://open.umn.edu/opentextbooks/textbooks/signal-computing-digital-signals-in-the-software-domain
- Downey, A. *Think DSP: Digital Signal Processing in Python* (2012). Open Textbook Library: https://open.umn.edu/opentextbooks/textbooks/think-dsp-digital-signal-processing-in-python
## External links
- [Live sketch: MP3](https://editor.p5js.org/sciencenibber/full/Pe3MkBkGg)
- [Editor (fork)](https://editor.p5js.org/sciencenibber/sketches/Pe3MkBkGg)
<!-- Hubs: Signal_processing. Portals: PORTAL_Signal_Processing. Signal Processing portal wave 1 · 2026-09-17 · drafted. -->