Search code examples
c++mp3decoding

Class for reading MP3 files


I am writing a game that is a bit depending on the soundtrack so I want to read mp3 file and use it's data (like the speed of music, beat and stuff). Is there any class (preferably) I could use or article that would cover everything about mp3 reading (from checking if it's an mp3 to actual decoding)? It's OK if I have to do different calculations to find the rhythm and stuff, I just wanna decode file as I don't know the algorithm (and don't know if it's complicated or not).


Solution

  • Yes, its complicated. MP3s are the typical lossy DCT compression scheme more or less. The process is similar to JPEG.

    Writing an mp3 decoder and encoder is a project in itself.

    Encode

    Quantize -> DCT Transform -> Entropy Encode -> Store

    Decode

    Entropy Decode -> IDCT -> Dequantize -> play

    I suggest FMOD its widely accepted and used in the gaming community.