MP3 Metadata from files on SD Module

Hi,

I am a mildly experienced Arduino hobbyist, and I am currently progressing well coding an alarm clock/mp3 player, with one exception: I can't figure out how to get mp3 metadata. I am using a MD_YX5300 mp3 player board by Catalex. I have already explored this board's capabilities and it is not capable of producing the information I require. I am also using an SD module for other things in this project, and I would like to place my playlist on the SD card as well as the Catalex and somehow get the info from there, even though I do not depend on it for the actual playing of the song. Does anybody know how to do this? Is there a library? I've already done some research but have found nothing. The pieces of info crucial to my project are song name, song band and song album. A couple of other things that would be nice to have are the song length and the song art, but I personally doubt this is included in the actual mp3 file and even if it was it is of no use to me if it is not sized to 240x240p.

P.S. If it is of any use, I am using an ESP32 Dev Module.

Thanks so much!

There are so many serial mp3 player boards out there, some support meta data query, and they are cheap, is there any particular reason you want to use your current board?

I am happy with the board I am using, and I don't see the point of buying a new piece of hardware when my current board suits my needs just find. (Beyond the current issue, that is. But I'm confident there is a way using the SD module). Back to the problem at hand, does anybody know a way to access the metadata?

I've never done this but I know something about MP3 & ID3 tags.

Usually the processor can't read from an SDcard plugged into a sound module...

I doubt there is a library but ID3.org has "generic" code examples and all of the technical data you should need. Wikipedia also has some good information.

If you can read the file you can search-through the file to find the metadata. It gets tricky because there are two different popular standards, ID3v1 and ID3v2. Not only are the standards different v1 tags are at the end of the file and v2 tags are at the beginning.

I don't know if there's a library but ID3.org has "generic" code examples and all of the technical data you should need. Wikipedia also has some good information.

Just to educate yourself, you can use a hex editor on your computer to look at the MP3, and you can search for 'TAG' (ID3v1) or 'TPE1' (the ID3v2 artist tag), etc.

There is an ID3v2 tag called 'TLEN' but it's optional. Normally the length (playing time) is calculated and that gets tricky for VBR files. CodeProject has some example code, but it's not specifically for the Arduino.

MP3Tag can add the art, but you'll have to size/scale it first.

Thanks for the quick reply! :grinning:

ID3.org is very useful, it tells me exactly where the metadata is located in each file. The only problem is I have no idea how to access the raw data of an mp3 file. I tried the same way you would a txt file, but it didn't print anything. Besides that, I have no idea how an mp3 file is encoded. Is it Hex? Binary? I hope this isn't common knowledge that I'm just missing out on. :no_mouth:

Would you mind filling me in? Thanks!

Anybody? I'm looking for a way to read the raw data from an mp3 file. If possible, I would like access to a library to read mp3 metadata, but if I can access the raw data of an mp3 file then I will be able to read the metadata using the info on ID3.org.

Can't help you but the data is binary; fyi, HEX is just a text representation of binary data.

Yes, I simply thought that arduino might present it in a hex format. Any idea how I grab these values?

Did you look at the datasheet of the XY5300 chip? https://raw.githubusercontent.com/0xcafed00d/yx5300/master/docs/YX5300-24SS%20Datasheet%20V1.0.pdf.

Unfortunately chinese is not my language; I think I can order a beer but that's about it. I went through the commands and don't immediately see how it can be done.

Yes, I've fully explored the board's capabilities and have the english translation of that same data sheet on file. No dice.