Lightweight C MP3 ID3v2 Reader

Oct 29, 2010 | Comments: 0 | Posted in:

hex editor viewing an mp3 headerSimple, effective, lightweight, and fast, this MP3 ID3v2 reader is the ideal way to go if you're running an embedded system running C.

Downloads

I'm a firm believer in having the download front and center. So here you are:

  • Demo program, testing_id3.zip - tested on osx and ubuntu.
  • Here's the project on my svn repo viewer where you can download the latest version (and track changes if you want).

Background

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.

Alternatives

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.

Implementation

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[40];

read_ID3_info(TITLE_ID3,str,sizeof(str),&file);

printf("Title: %s\n",str);

f_close(&file);

For running on a desktop I've got an example project here, complete with an mp3 to test with.

screenshot of how to make and run the demo program

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.

Feedback

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). Leave a comment here or send an email.

Lisence / Copyright

This work is lisenced under the Creative Commons Attribution-ShareAlike 3.0. See source code comments for details. I'm flexable if this is incompatable with your needs, just email me and ask.


Site by Tim O'Brien. Powered by zenphoto cms. Random Photo

Shopping Cart