#i nclude <reg52.h>
#i nclude <intrins.h>
#define FREQ 11059200
// 音乐_编码2 -- 存储器定义 //
unsigned char code music_tab1[]={ //音符码格式:| D7 |D6 D5 D4| D3 |D2
D1 D0|
//梁祝 |变调| 节拍|升降| 音
符 |
0xcb, //示例:0xcb=11001011B,即升调,4/16拍,3Mi低
音
0x35,0x16,0xb9,0x12,0x96,0x99,0xa5,
0xbd,0x99,0x96,0x15,0x13,0x15,0x62,
0x32,0x13,0xa7,0x26,0x25,0x16,0xa9,0x22,
0xa3,0xa9,0x96,0x15,0x16,0x99,0xe5,
0xbb,0x15,0xa7,0xaa,0x96,0x99,0xd5,
0x13,0x15,0x23,0x15,0x16,0x17,0x9a,0xd6,0x15,0x16,
0xb9,0x12,0x25,0x23,0x23,0x22,0x13,0x12,0x21,0x96,0x15,
0x43,0xc9,0x96,0x99,0x96,0x15,0x13,0x15,0x16,0x99,
0xd5, //功能码格式:| D7 D6 D5 D4 | D3 D2
D1 D0|
// |高4位=0时是功能码|根据低4位
散转 |
0x00, //最后字节为功能码必须==0x00退出
};
unsigned char code music_tab2[]={ //康定情歌
0x23,0x25,0x26,0x16,0x15, 0x36,0x13,0x42,
0x23,0x25,0x26,0x16,0x15, 0x26,0x53,
0x23,0x25,0x26,0x16,0x15, 0x26,0x23,0x42,
0x25,0x23,0x12,0x13,0x12,0x11, 0x22,0xd6,
0x26,0xda, 0x25,0x53, 0x12,0x11,0xd6,
0xad,0x23,0x12,0x13,0x12,0x11, 0x22,0xd6,
0x00,
};
unsigned char code music_tab3[]={ //美酒加咖啡
0x55,0x23,0x25,0x26,0xa9,0x22, 0x73,
0x45,0x25,0x26,0x23,0x22,0x21,0x23, 0x72,
0x52,0x23,0x45,0x43, 0x22,0x21,0xa6,0x25,0x66,
0xc9,0xa6,0x25,0x23,0x25,0x26,0xa9, 0xf5,
0x45,0x23,0x25,0x46,0xc9, 0x22,0x13,0x12,0x21,0x22,0x63,
0x22,0x23,0x25,0x26,0x25,0x23,0x22,0x21, 0x72,
0x52,0x23,0x45,0x43, 0x22,0x21,0xa6,0x25,0x66,
0xb9,0x12,0x23,0x25,0x22,0xa5,0xab,0x22, 0x71,
0x00,
};
unsigned char code music_tab4[]={ //北国之春
0x15,0x16,0x75, 0x15,0x16,0x55,0x13,0x15,0x16,0x15,0x16,0x99,0x12,0x13,
0x65,0x45,0x13,0x12,0x11,0x12, 0x73,
0x62,0x42,0x12,0x11,0x96,0x15, 0x76,
0x55,0x23,0x45,0xa9,0x22, 0x53,0x12,0x13,0x65,
0x52,0x22,0x42,0x21,0xa6, 0xe9,0x91,0x12,0x13,0x12,0x13,0x15,0x99,0x12,
//以上为过门
0x20,0x23,0x23,0x23,0x63, 0x22,0x23,0x23,0x22,0x41,0xa6,0x25,
0x53,0x22,0x21,0xa9,0x21,0xa6, 0x75,
0x26,0xa9,0x21,0xa6,0xc9,0x12,0x11,0x96,0x15,
0x23,0x25,0x25,0x26,0x45,0x21,0x22,
0x13,0x35,0x25,0xa9,0xa6,0x25,0x23,0x22, 0x71,
0x52,0x25,0x45,0x13,0x15,0x13,0x12, 0x21,0x41,0x22,0x43,0x45,
0x23,0x25,0x26,0xa9,0x42,0x12,0x33, 0x72,
0x51,0x22,0x43,0x22,0x21, 0xc6,0xc9,0x29,0xc6,0x45,0x23,0x23,
0x53,0x25,0x26,0x25,0x13,0x12,0x21, 0x62,0x42,0x23,0x25,
0x55,0x26,0x25,0x23,0x45, 0x26,0xa9,0x21,0x22,0x63,
0x52,0x22,0x22,0x13,0x12,0x21,0xa6,0xf9,
0x00,
};
unsigned char code music_l_tab[8]={0,1,2,3,4,6,8,16};//节拍延时单位
unsigned char code music_freq_tab[64]={ //音符定时器值表
0xff,0xea, //0 休止符
255-FREQ/24/131/256, //256-FREQ/24/x/256 //1 do 高字节
256-FREQ/24/131%256, //256-FREQ/24/x%256 //1 do 低字节
255-FREQ/24/147/256,256-FREQ/24/147%256, //2 re
255-FREQ/24/165/256,256-FREQ/24/165%256, //3 mi
255-FREQ/24/175/256,256-FREQ/24/175%256, //4 fa
255-FREQ/24/196/256,256-FREQ/24/196%256, //5 suo
255-FREQ/24/221/256,256-FREQ/24/221%256, //6 la
255-FREQ/24/248/256,256-FREQ/24/248%256, //7 xi
0xff,0xea, //0 休止符
255-FREQ/24/262/256,256-FREQ/24/262%256, //1 do
255-FREQ/24/294/256,256-FREQ/24/294%256, //2 re
255-FREQ/24/330/256,256-FREQ/24/330%256, //3 mi
255-FREQ/24/350/256,256-FREQ/24/350%256, //4 fa
255-FREQ/24/393/256,256-FREQ/24/393%256, //5 suo
255-FREQ/24/441/256,256-FREQ/24/441%256, //6 la
255-FREQ/24/495/256,256-FREQ/24/495%256, //7 xi
0xff,0xea, //0 休止符
255-FREQ/24/525/256,256-FREQ/24/525%256, //1 do
255-FREQ/24/589/256,256-FREQ/24/589%256, //2 re
255-FREQ/24/661/256,256-FREQ/24/661%256, //3 mi
255-FREQ/24/700/256,256-FREQ/24/700%256, //4 fa
255-FREQ/24/786/256,256-FREQ/24/786%256, //5 suo
255-FREQ/24/882/256,256-FREQ/24/882%256, //6 la
255-FREQ/24/990/256,256-FREQ/24/990%256, //7 xi
0xff,0xea, //0 休止符
255-FREQ/24/1049/256,256-FREQ/24/1049%256, //1 do
255-FREQ/24/1178/256,256-FREQ/24/1178%256, //2 re
255-FREQ/24/1322/256,256-FREQ/24/1322%256, //3 mi
255-FREQ/24/1400/256,256-FREQ/24/1400%256, //4 fa
255-FREQ/24/1572/256,256-FREQ/24/1572%256, //5 suo
255-FREQ/24/1665/256,256-FREQ/24/1665%256, //6 la
255-FREQ/24/1869/256,256-FREQ/24/1869%256, //7 xi
};
unsigned char code music_frequp_tab[64]={ //升半音
0xff,0xea, //0 休止符
255-FREQ/24/139/256, //1 do 高字节 //255-FREQ/24/x/256
256-FREQ/24/139%256, //1 do 低字节 //256-FREQ/24/x%256
255-FREQ/24/156/256,256-FREQ/24/156%256, //2 re
255-FREQ/24/175/256,256-FREQ/24/175%256, //3 mi
255-FREQ/24/185/256,256-FREQ/24/185%256, //4 fa
255-FREQ/24/208/256,256-FREQ/24/208%256, //5 suo
255-FREQ/24/234/256,256-FREQ/24/234%256, //6 la
255-FREQ/24/262/256,256-FREQ/24/262%256, //7 xi
0xff,0xea, //0 休止符
255-FREQ/24/278/256,256-FREQ/24/278%256, //1 do
255-FREQ/24/312/256,256-FREQ/24/312%256, //2 re
255-FREQ/24/350/256,256-FREQ/24/350%256, //3 mi
255-FREQ/24/371/256,256-FREQ/24/371%256, //4 fa
255-FREQ/24/416/256,256-FREQ/24/416%256, //5 suo
255-FREQ/24/467/256,256-FREQ/24/467%256, //6 la
255-FREQ/24/525/256,256-FREQ/24/525%256, //7 xi |