开发者

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 r开发者_StackOverflow社区hythm and stuff, I just wanna decode file as I don't know the algorithm (and don't know if it's complicated or not).


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.


Maybe have a look at mpeglib or SDL_mixer: http://www.libsdl.org/projects/SDL_mixer/ :) Are you under Windows?

The mp3 encoding/decoding process is pretty cool but I wouldn't go anywhere near writing your own decoder, the problem space is HUGE (and many mp3 files don't stick to the format). There are plenty of libraries out there, you just have to find one which suits!

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜