Long time ago I wrote an article Detect file type or mime type based on content. If you look at the XML file that contained magic signature of different file types, one of the type was MP3 files. And magic signature for MP3 files is that first 3 bytes of file content are ID3. The format of MP3 files is very well defined and explained at ID3.org. Although it is very well defined but it is not something very straight forward and not a job for faint heart to understand it.
For one of new development adventure I am tasked with digging little bit deep into file structure of MP3 files and find out some meta data. Things like Artist Name, Title, Track Number, Year Of Release etc. So I looked around the site and found reference to IDSharp library developed for .Net and is COM visible as well. So you can use it in any application that can invoke COM interfaces. The library is available on sourceforge. But there is no source code for the actual core library. It is only available as .Net assembly. I really needed source code for it because I was curious about implementation and I had to make some modifications as well for the kind of work I was doing.
So I fired up good old tool Reflector and dis-assembled the assembly to generate the source code for it. I had to fix few compile errors after disassembly. But finally I made it to work as expected. So I thought I will share the source code of IdSharp library with people who are interested in it.
Download Source Code For IdSharp Library
static void Main(string[] args)
{
var id3v2 = ID3v2Helper.CreateID3v2("Hello.mp3");
Console.WriteLine("Artist: {0}", id3v2.Artist);
Console.WriteLine("Title: {0}", id3v2.Title);
Console.WriteLine("Album: {0}", id3v2.Album);
Console.WriteLine("Genre: {0}", id3v2.Genre);
Console.WriteLine("Year: {0}", id3v2.Year);
Console.WriteLine("TrackNumber: {0}", id3v2.TrackNumber);
Console.WriteLine("Media Type: {0}", id3v2.MediaType);
Console.WriteLine("CD Identifier: {0}", id3v2.MusicCDIdentifier.TOC);
id3v2.Artist = "Byteblocks.com";
id3v2.Title = "ID3v2 Song";
id3v2.Save("Bytes.mp3");
}
Include missing files in Git repository using Visual Studio
How to plan CCSP Exam preparation
Develop a MongoDB pipeline to transform data into time buckets
Alert and Confirm pop up using BootBox in AngularJS
AngularJS Grouped Bar Chart and Line Chart using D3
How to lock and unlock account in Asp.Net Identity provider
2024 © Byteblocks, ALL Rights Reserved. Privacy Policy | Terms of Use