Super lightweight MP3 ID3 metadata tag reader made for embedded systems.
Now on GitHub!
I’m writing a full-featured mp3 player for the SJSU class CMPE 146, Embedded Microprocessor System Design, that runs on the LPC2148 ARM7 Board from sjvalley. The project is running RTOS and has reads files from a SD card streams them through an MP3 decoder to a DAC and finally your headphones.
The project is coming along nicely but I wanted a way to read ID3 tags so read_ID3_info() was born.
The implementations for c/c++, according to http://www.id3.org/ are thus:
Each of these libraries were too large and complicated to run on an embedded system although they offered many cool features. The library I’ve written is just one function, read_ID3_info(). It works well on my desktop and on my LPC2148 ARM7 board using FatFs from elm-chan.org.
Here’s an example for running on the LPC2148 ARM7 board using FatFs functions:
FIL file; f_open(&file, file_name, (FA_READ | FA_OPEN_EXISTING)); char str; read_ID3_info(TITLE_ID3,str,sizeof(str),&file); printf("Title: %s\n",str); f_close(&file);
For running on a desktop I made a demo program which is now also in the github project.
You can run the test program, read_id3, with a mp3 file as an argument. You may also run it with a directory as an argument and the program will scan that directory for any .mp3 files and list the info on them.
I’ve spend many a night on a hex editor and id3.org writing this and I hope it helps out at least someone. If anyone has any suggestions, finds any bugs, or comes up with an especially cool use for it I’d like to hear about it (yes, even the bugs). File a bug on GitHub and/or send an email.
This work is licensed under the Creative Commons Attribution-ShareAlike 3.0. See source code comments for details. I’m flexible if this is incompatible with your needs, just email me and ask.