I am trying to read the tags from mp3 files. I was wondering if anyone had any suggestions as to how to do this? I don't want to use a 3rd party library to handle the reading/organizing for me. The purpose of this is just for me to figure out how to read the encoded data? I know that there are primarily 2 different formats, ID3v1 and ID3v2. Really, my issue is just being able to obtain the information in a format that I can handle it. I have a couple ideas for actually storing the data I need and parsing the information once I get it. I mainly just need some guidance for how to collect the metadata in plain text.
-
2You are just giving yourself problems. Use a thrid party like Taglib. See http://stackoverflow.com/questions/6505870/how-to-get-the-properties-of-a-mp3-file-in-c-sharp/6505929#6505929 – Avada Kedavra Jul 06 '12 at 21:17
-
1@AvadaKedavra - I would prefer NOT to use a 3rd party library which all of those posts suggest. I followed an additional link, but most of the responses there also suggest 3rd party libraries. The single instance of code after some digging was helpful, but only applicable to ID3v1. Thank you though. – tcannon91 Jul 06 '12 at 21:23
3 Answers
Ok, I am not discouraging writing your own code (as my comment to the question may suggest). Actually the opposite, Kudos to you for wanting to develop your own library.
That said, Taglib sharp is open source and deals with both Id3v1 and id3v2 (and lots more), it should be a good place to start. I ported some parts of it to silverlight a while back, if I remember correctly it was not an overwhelming amount of code.

- 8,523
- 5
- 32
- 48
-
Taglib is really #1. It reads everything ad supports both Id3v1 and id3v2 what's amazing. I'd even donate it, but seems that's GNU and not sure where to do that. – Agat Feb 01 '13 at 23:59
Use binary reader object. http://msdn.microsoft.com/en-us/library/system.io.binaryreader.aspx
example of common lisp (id3 parser): http://www.gigamonkeys.com/book/practical-an-id3-parser.html

- 158
- 6
-
Great, thanks for the lisp id3 parser link. I am not super familiar with lisp, but I think I know it well enough to get what I need from the page – tcannon91 Jul 06 '12 at 21:30
I would recommend browsing the SVN from C# ID3 Library to get the code you need. http://sourceforge.net/projects/csid3lib/
I've got a few WPF apps on the market that edit mp3 files and the others recommending taglib sharp are correct, you should avoid the hassle and use it.

- 950
- 1
- 10
- 16
-
I would like to learn how to do the things Taglib and id3lib for myself. Thanks for the C# sourceforge link. I have a C version, but it is a little bit harder for me to navigate all of the files, I will definitely sift through the link you sent. – tcannon91 Jul 06 '12 at 21:37