MP3的一些资料

来源:互联网 发布:淘宝手机二维码链接 编辑:程序博客网 时间:2024/04/30 03:13
只知道这个描述语言不是JAVA、C,是什么不知道,但大概就是这个样子,没啥难度。

ID3v1 Tags

## 因为 ID3v2 比较复杂,连FOOBAR都不支持它,我想写的东西也就不支持算了,免得麻烦
## 怎么感觉这里不是这样呢,上次看到的是 ID3v1 是在文件的头部的,用UE打开MP3好像也是在头部
The ID3v1 tag is found at the end of an MP3 file and has a fixed number of fields and size. The structure of the tag is as follows:

Private Type MP3ID3V1Tag  Tag As String * 3           '-- 03 = "TAG"  Title As String * 30        '-- 33  Artist As String * 30       '-- 63  Album As String * 30        '-- 93  Year As String * 4          '-- 97  Comment As String * 30      '-- 127  Genre As Byte               '-- 128End Type

Note that v1.1 of the ID3v1 specification allows the last two bytes of the Comment tag to be used to store the track number. Byte 29 is always set to 0 in this case, and Byte 30 stores the track number itself.

Checking if an MP3 file contains an ID3v1 tag is a simple matter of rewinding 128 bytes from the end and checking if the bytes read "TAG". If they do, then the rest of the bytes are the tag itself. Reading and writing the tag is simple: if its already there, then you just fill in the structure and then write it over the last 128 bytes of the file. If the tag isn't there, then just append a structure to the end of the file.

###  下面的资料是在这个地方找的,http://www.dv.co.yu/mpgscript/mpeghdr.htm,更多资料可以要查看

MPEG Audio Tag ID3v1

  • The TAG is used to describe the MPEG Audio file. It contains information about artist, title, album, publishing year and genre. There is some extra space for comments. It is exactly 128 bytes long and is located at very end of the audio data. You can get it by reading the last 128 bytes of the MPEG audio file.


    ## 在昨天写的那个程序中,如果把读进来的 String tag 都打印出来的话,可以看到一些效果,当然,那些东西是复制不出来的,只可以自己运行出来看

    AAABBBBB BBBBBBBB BBBBBBBB BBBBBBBB
    BCCCCCCC CCCCCCCC CCCCCCCC CCCCCCCD
    DDDDDDDD DDDDDDDD DDDDDDDD DDDDDEEE
    EFFFFFFF FFFFFFFF FFFFFFFF FFFFFFFG

    Sign

    Length
    (bytes)Position
    (bytes)DescriptionA3(0-2)Tag identification. Must contain 'TAG' if tag exists and is correct.B30(3-32)TitleC30(33-62)ArtistD30(63-92)AlbumE4(93-96)YearF30(97-126)CommentG1(127)Genre

    ## 这里提了,它用的编码与汉字的编码是不一样滴,所以我昨天写的那个程序没拿带中文的标签来做实验,呵呵,需要转换一下
    The specification asks for all fields to be padded with null character (ASCII 0). However, not all applications respect this (an example is WinAmp which pads fields with , ASCII 32).

    There is a small change proposed in ID3v1.1 structure. The last byte of the Comment field may be used to specify the track number of a song in an album. It should contain a null character (ASCII 0) if the information is unknown.

    Genre Bytes

      再加一些其它的资料,可能只是比较有利于阅读而以
      Genre is a numeric field which may have one of the following values:
      以下内容新添加于2005-08-09
       "Blues",   "Classic Rock",  "Country",     "Dance",     "Disco",
       "Funk",   "Grunge",    "Hip-Hop",     "Jazz",     "Metal",
       "New Age",   "Oldies",    "Other",     "Pop",      "R&B",
       "Rap",    "Reggae",    "Rock",     "Techno",     "Industrial",
       "Alternative",  "Ska",     "Death Metal",    "Pranks",     "Soundtrack",
       "Euro-Techno", "Ambient",    "Trip-Hop",    "Vocal",     "Jazz+Funk",
       "Fusion",   "Trance",    "Classical",    "Instrumental",   "Acid",
       "House",   "Game",    "Sound Clip",    "Gospel",     "Noise",
       "AlternRock",  "Bass",    "Soul",     "Punk",     "Space",
       "Meditative",  "Instrumental Pop", "Instrumental Rock",  "Ethnic",     "Gothic",
       "Darkwave",  "Techno-Industrial","Electronic",    "Pop-Folk",    "Eurodance",
       "Dream",   "Southern Rock",  "Comedy",     "Cult",     "Gangsta",
       "Top 40",   "Christian Rap",  "Pop/Funk",    "Jungle",     "Native American",
       "Cabaret",   "New Wave",   "Psychadelic",    "Rave",     "Showtunes",
       "Trailer",  "Lo-Fi",    "Tribal",     "Acid Punk",    "Acid Jazz",
       "Polka",   "Retro",    "Musical",     "Rock & Roll",    "Hard Rock",
       // 以下部分的流派最早是 Winamp 播放器专有的,不过好像现在很多播放器也包含了这些
       "Folk",   "Folk-Rock",   "National Folk",   "Swing",     "Fast Fusion",
       "Bebob",   "Latin",    "Revival",     "Celtic",     "Bluegrass",
       "Avantgarde",  "Gothic Rock",   "Progressive Rock",  "Psychedelic Rock",  "Symphonic Rock",
       "Slow Rock",  "Big Band",   "Chorus",     "Easy Listening",   "Acoustic",
       "Humour",   "Speech",    "Chanson",     "Opera",     "Chamber Music",
       "Sonata",   "Symphony",   "Booty Brass",    "Primus",     "Porn Groove",
       "Satire",   "Slow Jam",   "Club",     "Tango",     "Samba",
       "Folklore",  "Ballad",    "Power Ballad",   "Rhythmic Soul",   "Freestyle",
       "Duet",   "Punk Rock",   "Drum Solo",    "A Capela",    "Euro-House",
       "Dance Hall"
      这是所有的流派,即 Genre ,在 MP3 的 ID3v1 Tag 中,只是以一个数字代表流派的,所以做一个 MP3 的封装,少不了要加个个性流派的功能,在这里也补上此资料。
      今天去图书馆看关于音频的书,讲的都是编码、压缩的东西,目前看来,我是用不上的。

    PS于2005-08-12 05:55
    再贴两篇好文章进来:地址1,地址2。
  • 原创粉丝点击