Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Reading MP3 files [closed]

Tags:

I want to read MP3 files in C++ and I prefer to write my own code for this. Basically to learn how the filetype works. I want to read all the bits of hex data of a MP3 file and have my speakers play it. :) I have no idea where to start since I don't yet know how data is actually stored into a MP3 file.

Thanks for your help

like image 936
Midas Avatar asked Jun 03 '10 18:06

Midas


People also ask

How do I make my MP3 play continuously?

If you want to repeat the mp3 file over and over again, you can put the while loop: new Thread() { public void run() { try { while(true) { player.

Why are my MP3 files not playing?

MP3, like many other file types, can get corrupted and damaged due to various reasons. When these files are damaged, they won't play in any media players on your computer. You'll need to first repair those MP3 files before they can be played again. Damage to your MP3 files could be caused due to various factors.

How do I open an MP3 file?

How to open an MP3 file. You can open an MP3 file with most audio players. In Windows, you can use Microsoft Groove Music or Microsoft Windows Media Player, which are bundled with the operating system. In macOS, you can use Apple Music, which is bundled with that operating system.

Can you uncompress an MP3?

Mp3 is a format of codec, like jpeg. You can reformat them, yes. You can't uncompress them. Uncompressing them implies that the old data will be restored, which it wont.


2 Answers

Start by reading up on the structure on an mp3 file. Then, if you're still interested, find a good tutorial on how to decode the audio data in each frame. It's pretty complex, so you'll need to have a fair bit of time to do it from scratch.

like image 67
jball Avatar answered Oct 19 '22 22:10

jball


You can buy the specification for the MP3 format from here. It's about 160EUR.

Oh, and by the way, it's not "hex data". If you're still at the point where you refer to any non-human readable data as "hexadecimal" (which is a number system), delving head-first into a binary data format that involves complex decoding/encoding algorithms might be a bit too much for you for the time being.

How about starting by writing a player that can play .wav files? (Any reasonable .wav file, mind you, taking into account the file format and the different audio formats)

like image 30
Matti Virkkunen Avatar answered Oct 19 '22 22:10

Matti Virkkunen