This project has moved. For the latest updates, please go here.

You can create simple ID3v2 tags in NAudio by constructing a dictionary of IDs (4 character strings) and values. Here’s a simple example:

Dictionary<string, string> tags = new Dictionary<string, string>
{
 { "TIT2", "Song title" },
 { "TPE1", "Artist name" },
 { "TYER", "2012" }, /* year of the song */
 { "COMM", "Extra comment info" },
 { "TCON", "(110)Satire" } /* genre */ 
};
var tag = Id3v2Tag.Create(tags);

And then you can write this to your MP3 Stream (usually a FileStream)  using the RawData property:

output.Write(tag.RawData, 0, tag.RawData.Length);

Last edited Mar 7, 2012 at 4:19 PM by markheath, version 1

Comments

FabioSilva Sep 27, 2012 at 12:20 AM 
Hi, markheat, I like to read, you have an example?

Thanks