8.26 - MP3 reader


ID3 specifications apply to any file or audiovisual container. However, it is usually applied primarily audio containers. There are three versions of the specification that are compatible. For example, a file may contain labels simultaneously version 1.1 and version 2.0. In this case, the media player must decide which are relevant.

ID3 version 1
This first specification is very simple. It consists of attaching a fixed block size of 128 bytes at the end of the file in question. This block contains the following tags: A header that identifies the presence of block ID3 and version. Specifically, said header comprises TAG characters.

Title: 30 characters.
Artist: 30 characters.
Album: 30 characters.
Year: 4 characters.
Comment: 30 characters.
Genre (music): a character.

All tags using ASCII characters except gender, an integer stored within a single byte. The musical genre associated with each byte is predefined in the standard definitions and includes 80 genera, numbered 0 to 79. Some breeding programs have expanded their own defined genres (from 80th).


using System;
using System.IO;

public class MP3Reader
    public static void Main()
        FileStream myFile;
        byte[] data;
        int width, height;
        const int SIZE = 128;
        Console.Write("Enter the name of file: ");
        string fileName = Console.ReadLine();
            Console.WriteLine("The file not exists!!!");
            myFile = File.OpenRead(fileName);
            data = new byte[SIZE];
            myFile.Seek(-128, SeekOrigin.End);
            myFile.Read(data, 0, SIZE);
            byte b1 = data[0];
            byte b2 = data[1];
            byte b3 = data[2];
            if( (Convert.ToChar(b1) != 'T')
                || (Convert.ToChar(b2) != 'A')
                || (Convert.ToChar(b3) != 'G'))
                Console.WriteLine("This File is NOT a MP3 file with ID3 v1");
            string title = "";
            for (int i=3; i<33 data-blogger-escaped-0="" data-blogger-escaped-album="" data-blogger-escaped-author="" data-blogger-escaped-catch="" data-blogger-escaped-comments="" data-blogger-escaped-console.writeline="" data-blogger-escaped-convert.tochar="" data-blogger-escaped-data="" data-blogger-escaped-e.message="" data-blogger-escaped-e="" data-blogger-escaped-ear:="" data-blogger-escaped-enre:="" data-blogger-escaped-for="" data-blogger-escaped-i="" data-blogger-escaped-if="" data-blogger-escaped-int="" data-blogger-escaped-itle:="" data-blogger-escaped-lbum:="" data-blogger-escaped-omments:="" data-blogger-escaped-pre="" data-blogger-escaped-rror:="" data-blogger-escaped-string="" data-blogger-escaped-uthor:="" data-blogger-escaped-xception="" data-blogger-escaped-year="" title="">

Popular Posts