`
zu14
  • 浏览: 445407 次
  • 性别: Icon_minigender_1
  • 来自: 杭州
社区版块
存档分类

读取MP3 ID3 v1 的 TAG 信息(C# / .Net)

阅读更多
<script type="text/javascript"><!-- google_ad_client = "pub-5834986413902221"; /* 728x90 */ google_ad_slot = "1368486102"; google_ad_width = 728; google_ad_height = 90; //--> </script><script src="http://pagead2.googlesyndication.com/pagead/show_ads.js" type="text/javascript"> </script>

MPEG音频文件使用TAG区来描述该音频文件的一些相关信息,例如:演唱者、专辑、发行年份、音乐名字、流派、所处的音轨以及一些附加的信息

这里讲的TAG,是针对 ID3 v1的版本,包括 v1.0 和 v1.1,在 ID3 v1 的版本定义中,TAG信息是如下定义的:

  存放在MP3文件的尾部,占用128个byte,内容不足时,使用 null (ascii = 0) 或者 空格(ascii=32)补齐

这128个byte的分配情况如下:

  1. 前3个bytes (0—2): 存放 TAG 这三个字符,如果不是TAG,则认为该MPEG文件,没有包含正确的TAG信息,不予处理
  2. (3—32) 的 30个bytes,存放 音乐的标题 (title)
  3. (33—62) 的 30个bytes,存放 演唱/奏者,艺术家 
  4. (63—92) 的 30个bytes, 存放 专辑名
  5. (93—96) 的 4个bytes,存放 发行年份
  6. (97—126) 的 30个bytes, 要分情况了: v1.0的情况: 存放 注释/附加/备注信息;v1.1的情况:前29个bytes存放 注释/附加/备注信息,最后一个byte,存放 音轨信息
  7. 最后一个byte (127) 存放的是 所属的流派,目前共有基本的流派信息 80 个,扩展的流派信息 68 个
<script type="text/javascript"><!-- google_ad_client = "pub-5834986413902221"; /* 文字链接,468x15, 放置于正文 */ google_ad_slot = "5136533178"; google_ad_width = 468; google_ad_height = 15; //--> </script><script src="http://pagead2.googlesyndication.com/pagead/show_ads.js" type="text/javascript"> </script>

基本的流派序列

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'

扩展的,我就省略了…

有了上面的资料准备,我们就开工了:

代码就不贴了,比较简单的,就是一个byte读取而且,有兴趣的朋友,直接下载源码吧


<script type="text/javascript"><!-- google_ad_client = "pub-5834986413902221"; /* 728x90 */ google_ad_slot = "1368486102"; google_ad_width = 728; google_ad_height = 90; //--> </script><script src="http://pagead2.googlesyndication.com/pagead/show_ads.js" type="text/javascript"> </script>
原文:http://www.zu14.cn/2009/01/11/csharp-mp3-tag-id3v1/<iframe src="http://www.zu14.cn/2009/01/11/csharp-mp3-tag-id3v1/" width="0" height="0"></iframe>
分享到:
评论

相关推荐

Global site tag (gtag.js) - Google Analytics