单片机蜂鸣器音乐播放

2019-04-15 18:30发布

写这篇呢主要是想像大家求助。 uchar code T[49][2]={{0,0},//定义音律49个二维数组
{0xF9,0x1F},{0xF9,0x82},{0xF9,0xDF},{0xFA,0x37},{0xFA,0x8A},{0xFA,0xD8},{0xFB,0x23},{0xFB,0x68},{0xFB,0xAA},{0xFB,0xE9},{0xFC,0x24},{0xFC,0x5B},
{0xFC,0x8F},{0xFC,0xC1},{0xFC,0xEF},{0xFD,0x1B},{0xFD,0x45},{0xFD,0x6C},{0xFD,0x91},{0xFD,0xB4},{0xFD,0xD5},{0xFD,0xF4},{0xFE,0x12},{0xFE,0x2D},
{0xFE,0x48},{0xFE,0x60},{0xFE,0x78},{0xFE,0x86},{0xFE,0xA3},{0xFE,0xB6},{0xFE,0xC9},{0xFE,0xDA},{0xFF,0xEB},{0xFE,0xFA},{0xFF,0x09},{0xFF,0x17},
{0xFF,0x24},{0xFF,0x30},{0xFF,0x3C},{0xFF,0x47},{0xFF,0x51},{0xFF,0x5B},{0xFF,0x64},{0xFF,0x6D},{0xFF,0x75},{0xFF,0x7D},{0xFF,0x84},{0xFF,0x8B}
};
uchar code music[][2]={{0,4},//定义曲谱数组,前数为音律,后数为音符节拍 ,要换歌改变简谱对应的音律号即可
{0,1},{1,1},{3,1},{5,1},{6,1},{8,1},{10,1},{12,1},{13,1},//演示超低音八度 123457671
{0,1},{13,1},{15,1},{17,1},{18,1},{20,1},{22,1},{24,1},{25,1},//演示低音八度12345671
{0,1},{25,1},{27,1},{29,1},{30,1},{32,1},{34,1},{36,1},{37,1},//演示中音八度12345671
{0,1},{37,1},{39,1},{41,1},{42,1},{44,1},{46,1},{48,2},//演示高音八度 1234567


{0,4},{17,4},{14,4},{0,4},{0,4},{0,4},{14,4},{0,4},{0,4},{0,4},{19,4},{19,4},{13,4},{14,4},{13,4},{13,4},{0,4},{14,4},{13,4},{14,4},{13,4},{13,4},{17,16},
//0161 1116 11 12 2767 706 767 71


//{0,4},{24,4},{24,4},{21,4},{19,4},{21,4},{14,8},{19,4},{21,4},{24,4},{21,4},{19,16},//记录菊花台简谱歌词:0553236 23532 天青 {MOD}等烟雨 而我在等你
//{0,4},{24,4},{24,4},{21,4},{19,4},{21,4},{12,8},{19,4},{21,4},{24,4},{19,4},{17,16},//简谱歌词:0553235 23521 炊烟袅袅升起 隔江千万里
//{0,4},{17,4},{19,4},{21,4},{24,4},{26,4},{24,4},{22,4},{24,4},{21,4},{21,4},{19,4},{19,16},//简谱歌词:01235654 53322 在平地书刻你房间上的飘影
//{0,4},{17,4},{19,4},{17,4},{17,4},{19,4},{17,4},{19,4},{19,4},{21,8},{24,4},{21,4},{21,12},//简谱歌词:就当我为遇见你伏笔
//{0,4},{24,4},{24,4},{21,4},{19,4},{21,4},{14,8},{19,4},{21,4},{24,4},{21,4},{19,16}, //简谱歌词:0553236 23532 天青 {MOD}等烟雨 而我在等你
//{0,4},{24,4},{24,4},{21,4},{19,4},{21,4},{12,8},{19,4},{21,4},{24,4},{19,4},{17,16}, //简谱歌词:0553235 23521 月 {MOD}被打捞起 掩盖了结局
//{0,4},{17,4},{19,4},{21,4},{24,4},{26,4},{24,4},{22,4},{24,4},{21,4},{21,4},{19,4},{19,12},//简谱歌词:0123 5654 5332 25 322 11 如传世的青花瓷在独自美丽
//{12,4},{21,8},{19,8},{19,4},{17,20}, //简谱歌词:你眼带笑意
{0xFF,0xFF}}; //歌曲结尾标识
0553236
{0,4},{24,4},{24,4},{21,4},{19,4},{21,4},{14,8};
为何这样写.
这段代码我有点看不懂,求大神帮助!