C# lib to read and write ID3 tags of MP3 files

V

Veerle

Hi,

I haven't been able to find a good tool to modify and manage the ID3
tags of my MP3 files in the way I want, so I decided to write my own
tool. Looking for a free .NET library on the internet to read and
write the ID3 tags v1 and v2 of the MP3 files the choice is rather
limited.

I tried a lot of libraries, but FMod (http://www.fmod.org/index.php/
download) is the first one that is actually able to retrieve all the
ID3 v1 and v2 correctly. It seems to me that the FMod library allows
to modify, delete and add tags as well, but I can't find the correct
method to do so or an example that shows me how to. Has anyone used
this library to add, delete or modify tags of an MP3? Can I get a
piece of sample code?

Perhaps anyone has experience with a good libary to read and write MP3
tags (both ID3 v1 and v2)? An not only the text tags but also for
example the image tag. Something that works well on Windows Vista in
C# .NET 2.0?

Thanks a lot in advance.
Veerle
 
K

Kerem Gümrükcü

Hi Verlee,

sorry for my first post. I hit the Send Button too fast *g*
Try them, they are good, a friend of mine used them once
and he told me that the lib was quiet good. I dont know
if this is till true. See for yourself:

http://home.fuse.net/honnert/hundred/

Regards

Kerem
 
E

eps

Kerem said:
Hi Verlee,

sorry for my first post. I hit the Send Button too fast *g*
Try them, they are good, a friend of mine used them once
and he told me that the lib was quiet good. I dont know
if this is till true. See for yourself:

http://home.fuse.net/honnert/hundred/

Regards

Kerem

I have used the above and found it had problems reading some tags (other
software such as winamp would read the tags fine).

The best tag library I am aware is taglib-sharp

http://www.taglib-sharp.com/Main_Page

I think it is structured better than the hundred miles library as well.
 
V

Veerle

The best tag library I am aware is taglib-sharp

http://www.taglib-sharp.com/Main_Page

I think it is structured better than the hundred miles library as well.

So I decided to try taglib sharp first. But the ID3v2 tags "Original
Artist", "URL" and "Encoded" which can be modified in WinAmp appear
not to accesible trough this library? I also can't seem to find the
"classification" tag that appears in iTunes.

Also saving modified tags doesn't work for me. I want to be able to
save the ID3v1 and ID3v2 tags seperately, so I wrote the code beneath.
Any idea what I do wrong and how I can save this tags seperatly?

// Get file
TagLib.File file = TagLib.File.Create(fileName);

// Clear ID3v1tags
TagLib.Id3v1.Tag id3v1Tag = file.GetTag(TagLib.TagTypes.Id3v1) as
TagLib.Id3v1.Tag;
id3v1Tag.Title = null;
id3v1Tag.Performers = new string[0];
id3v1Tag.Album = null;
id3v1Tag.Year = 0;
id3v1Tag.Comment = null;
id3v1Tag.Track = 0;
id3v1Tag.TrackCount = 0;
id3v1Tag.Genres = new string[0];

// Set ID3v2 tag values
TagLib.Id3v2.Tag id3v2Tag = file.GetTag(TagLib.TagTypes.Id3v2) as
TagLib.Id3v2.Tag;
id3v2Tag.Title = "something";
id3v2Tag.Performers = new string[] { "something" };
id3v2Tag.Album = "something";
id3v2Tag.Year = 2007;
id3v2Tag.Track = 1;
id3v2Tag.TrackCount = 10;
id3v2Tag.Genres = new string[] { "Pop" };
id3v2Tag.Disc = 1;
id3v2Tag.Comment = "something";
id3v2Tag.AlbumArtists = new string[0]; ;
id3v2Tag.Composers = new string[0]; ;
id3v2Tag.Copyright = "something";

// Save
file.Save();
 
E

eps

Veerle said:
Also saving modified tags doesn't work for me. I want to be able to
save the ID3v1 and ID3v2 tags seperately, so I wrote the code beneath.
Any idea what I do wrong and how I can save this tags seperatly?

// Get file
TagLib.File file = TagLib.File.Create(fileName);

Do you get an excpetion or an error message ?, to be honest you are
better off posting this in the taglibsharp forum than here.
 
V

Veerle

Do you get an excpetion or an error message ?, to be honest you are
better off posting this in the taglibsharp forum than here.

I don't get an error message or exception. I will post it in the
taglibsharp forum.

I tried the Hundred Miles library too, but it doesn't read some ID3v2
tags correctly. In Winamp I see ID3v2 tags for some mp3s, but Hundred
Miles acts like these tags are not filled in. This is probably because
they only support ID3v23 and not the other versions of ID3v2, I guess.

I also tried C# ID3 Library (http://sourceforge.net/project/
showfiles.php?group_id=89188&package_id=93467&release_id=186994). This
seems great with ID3v2 but it doesn't read the ID3v1 tags correctly
allthough they provide methods and classes to retrieve this data as
well.

Anyone tried accessing the WinAmp or iTunes dlls that come with
installation through C#? Or anyone have another suggestion for a good
library?
 
E

eps

Veerle said:
Anyone tried accessing the WinAmp or iTunes dlls that come with
installation through C#? Or anyone have another suggestion for a good
library?

I have not tried using dll's provided by winamp or itunes, unless they
support com interop I would have no idea how to access them from .net

I tried loads of id3tag libraries, the only two that were usable for my
purposes were taglib-sharp and the hundredmiles one. taglib-sharp is
still being actively developed I believe whereas the hundredmiles
library was last updated in 2006. For me the taglib-sharp is pretty
much flawless, but I am not particularly fussy about the specific types
of my tags.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top