A few weeks back, I spent some time reading about

Arpit Bhayani

Arpit Bhayani

Jan 13, 2024 • 1 min read


A few weeks back, I spent some time reading about the internals of MP3 file format, and here is a very high-level overview of it ⚡

The audio is divided into smaller segments by time. Each segment then goes through a Fourier Transform.

Fourier transform decomposes the sound wave into a sum of various sine and cosine waves of different frequencies. Now the frequencies that cannot be perceived by humans are eliminated.

The remaining audio data is further compressed using lossy compression techniques like quantization, and lossless like Huffman coding.

Each segment is then put into the MP3 file as one frame (oversimplified) which contains a header and a data section.

The header section contains information about the frame’s size, and bitrate while the data section contains the compressed audio data.

The frames are then combined to complete the MP3 file.

If you are interested in exploring the internals of this format, here are two resources that I would highly recommend

  1. Wikipedia page on MP3
  2. Research paper “MP3 AND AAC explained” (just search on Google Scholar)

Will be spending a couple of weekends writing my own encoders and decoders. Seems quite complex, but fun 🙈

Arpit Bhayani

Principal Engineer II at Razorpay - building Agent Studio, Ex-staff engg at GCP Memorystore & Dataproc, Creator of DiceDB, ex-Amazon Fast Data, ex-Director of Engg. SRE and Data Engineering at Unacademy. I spark engineering curiosity through my no-fluff engineering videos on YouTube and my courses