只知道这个描述语言不是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 '-- 128
End 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) |
Description |
A |
3 |
(0-2) |
Tag identification. Must contain 'TAG' if tag exists and is correct. |
B |
30 |
(3-32) |
Title |
C |
30 |
(33-62) |
Artist |
D |
30 |
(63-92) |
Album |
E |
4 |
(93-96) |
Year |
F |
30 |
(97-126) |
Comment |
G |
1 |
(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:
0 |
'Blues' |
20 |
'Alternative' |
40 |
'AlternRock' |
60 |
'Top 40' |
1 |
'Classic Rock' |
21 |
'Ska' |
41 |
'Bass' |
61 |
'Christian Rap' |
2 |
'Country' |
22 |
'Death Metal' |
42 |
'Soul' |
62 |
'Pop/Funk' |
3 |
'Dance' |
23 |
'Pranks' |
43 |
'Punk' |
63 |
'Jungle' |
4 |
'Disco' |
24 |
'Soundtrack' |
44 |
'Space' |
64 |
'Native American' |
5 |
'Funk' |
25 |
'Euro-Techno' |
45 |
'Meditative' |
65 |
'Cabaret' |
6 |
'Grunge' |
26 |
'Ambient' |
46 |
'Instrumental Pop' |
66 |
'New Wave' |
7 |
'Hip-Hop' |
27 |
'Trip-Hop' |
47 |
'Instrumental Rock' |
67 |
'Psychadelic' |
8 |
'Jazz' |
28 |
'Vocal' |
48 |
'Ethnic' |
68 |
'Rave' |
9 |
'Metal' |
29 |
'Jazz+Funk' |
49 |
'Gothic' |
69 |
'Showtunes' |
10 |
'New Age' |
30 |
'Fusion' |
50 |
'Darkwave' |
70 |
'Trailer' |
11 |
'Oldies' |
31 |
'Trance' |
51 |
'Techno-Industrial' |
71 |
'Lo-Fi' |
12 |
'Other' |
32 |
'Classical' |
52 |
'Electronic' |
72 |
'Tribal' |
13 |
'Pop' |
33 |
'Instrumental' |
53 |
'Pop-Folk' |
73 |
'Acid Punk' |
14 |
'R&B' |
34 |
'Acid' |
54 |
'Eurodance' |
74 |
'Acid Jazz' |
15 |
'Rap' |
35 |
'House' |
55 |
'Dream' |
75 |
'Polka' |
16 |
'Reggae' |
36 |
'Game' |
56 |
'Southern Rock' |
76 |
'Retro' |
17 |
'Rock' |
37 |
'Sound Clip' |
57 |
'Comedy' |
77 |
'Musical' |
18 |
'Techno' |
38 |
'Gospel' |
58 |
'Cult' |
78 |
'Rock & Roll' |
19 |
'Industrial' |
39 |
'Noise' |
59 |
'Gangsta' |
79 |
'Hard Rock' |
WinAmp expanded this table with next codes:
80 |
'Folk' |
92 |
'Progressive Rock' |
104 |
'Chamber Music' |
116 |
'Ballad' |
81 |
'Folk-Rock' |
93 |
'Psychedelic Rock' |
105 |
'Sonata' |
117 |
'Poweer Ballad' |
82 |
'National Folk' |
94 |
'Symphonic Rock' |
106 |
'Symphony' |
118 |
'Rhytmic Soul' |
83 |
'Swing' |
95 |
'Slow Rock' |
107 |
'Booty Brass' |
119 |
'Freestyle' |
84 |
'Fast Fusion' |
96 |
'Big Band' |
108 |
'Primus' |
120 |
'Duet' |
85 |
'Bebob' |
97 |
'Chorus' |
109 |
'Porn Groove' |
121 |
'Punk Rock' |
86 |
'Latin' |
98 |
'Easy Listening' |
110 |
'Satire' |
122 |
'Drum Solo' |
87 |
'Revival' |
99 |
'Acoustic' |
111 |
'Slow Jam' |
123 |
'A Capela' |
88 |
'Celtic' |
100 |
'Humour' |
112 |
'Club' |
124 |
'Euro-House' |
89 |
'Bluegrass' |
101 |
'Speech' |
113 |
'Tango' |
125 |
'Dance Hall' |
90 |
'Avantgarde' |
102 |
'Chanson' |
114 |
'Samba' |
|
|
91 |
'Gothic Rock' |
103 |
'Opera' |
115 |
'Folklore' |
|
|
Any other value should be considered as 'Unknown' |