Quantcast
Channel: NAudio
Viewing all articles
Browse latest Browse all 5831

Updated Wiki: Create an ID3v2 Tag

$
0
0

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);

Viewing all articles
Browse latest Browse all 5831

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>