C语⾳⾳乐旋律代码-⽹络神曲
最近的⽹络神曲我都能⽤C语⾳⾳乐旋律代码进⾏合成,运⾏效果不错。
1.《蜜雪冰城主题曲》`
//Beep()函数,头⽂件windows.h
//函数内容(赫兹,持续时间)
#include<stdio.h>
#include<windows.h>
typedef struct
{
int freq;//赫兹
int duration;//持续时间
char text[32];//⽂本内容
}STU;
STU
t[]={{1318,300,"你"},{1568,300,"爱"},{1568,300,"我"},{1772,150,""},{1568,300,"我"},{1318,300,"爱"},{1046,300,"你"}, {1046,150,"蜜"},{1175,150,"雪"},{1318,150,"冰"},{1318,450,"城"},{1175,300,"甜"},{1046,300,"蜜"},{1175,1900,"蜜\n"}, {1318,300,"你"},{1568,300,"爱"},{1568,300,"我"},{1772,150,""},{1568,300,"我"},{1318,300,"爱"},{1046,300,"你"}, {1046,150,"蜜"},{1175,150,"雪"},{1318,150,"冰"},{1318,450,"城"},{1175,300,"甜"},{1175,300,"蜜"},{1046,1900,"蜜\n"}, {1404,600,"你"},{1404,300,"爱"},{1318,300,""},{1404,300,"我"},{1772,150,"呀"},{0,600,""},
{1568,600,"我"},{1568,300,"爱"},{1318,300,""},{1175,900,"你\n"},
{1318,300,"你"},{1568,300,"爱"},{1568,300,"我"},{1772,150,""},{1568,300,"我"},{1318,300,"爱"},{1046,300,"你"}, {1046,150,"蜜"},{1175,150,"雪"},{1318,150,"冰"},{1318,450,"城"},{1175,300,"甜"},{1175,300,"蜜"},{1046,1900,"蜜\n"},};
main()
{
int i;
//结构体数组的长度sizeof(t)/sizeof(STU)得到,总结构体数组⼤⼩ / 单个结构体⼤⼩
for(i=0; i<sizeof(t)/sizeof(STU); i++)
{
printf("%s",t[i].text);
Beep(t[i].freq,t[i].duration);
}
}
2.《热爱105°的你》
//Beep()函数,头⽂件windows.h
/
/函数内容(赫兹,持续时间)
#include<stdio.h>
#include<windows.h>
typedef struct
{
int freq;//赫兹
int duration;//持续时间
char text[32];//⽂本内容
}STU;
STU
t[]={{1318,250,"Su"},{1318,250,"per"},{1404,250," ld"},{1318,250,"ol"},{1175,250,"的"},{1318,250,"笑"},
{880,500,"容"}, {1175,250,"都"},{1046,250,"美"},{880,500,"丽"},{1046,500,"的"},{1175,500,"甜\n"},
{1175,250,"⼋"},{1175,250,"⽉"},{1318,250,"正"},{1175,250,"午"},{1046,250,"的"},{1175,250,"阳"},{1318,500,"光"}, {1046,250,"都"},{880,250,"没"},{1046,500,"你"},{1046,500,"耀"},{880,500,"眼\n"},
{1318,250,"热"},{1318,250,"爱"},{1404,250," 105"},{1318,250,""},{1175,250,""},{1046,250,""},{1318,250,"度"},{1175,125,""}, {1175,250,"的"},{1318,250,""},{880,500,"你\n"},
{880,250,"滴"},{1046,250,"滴"},{988,500,"清"},{988,500,"纯的"},
{1318,500,"蒸"},{1318,500,"馏"},{1046,2500,"⽔\n"},
{1318,250,"在"},{1318,250,"这"},{1404,250," 独"},{1318,250,"⼀"},{1175,250,"⽆"},{1046,250,"⼆"},{880,500,"属"},
{1175,250,"于"},{1046,250,"我"},{880,500,"的"},{1046,500,"时"},{1175,500,"代\n"},
{1175,250,"莫"},{1175,250,"忘"},{1318,250,"了"},{1175,250,"初"},{1046,250,"⼼"},{1175,250,"常"},{1318,500,"在"}, {1046,250,"痛"},{880,250,"快"},{1046,500,"去"},{1046,500,"热"},{880,500,"爱\n"},
{1318,250,"热"},{1318,250,"爱"},{1404,250," 105"},{1318,250,""},{1175,250,""},{1046,250,""},{1318,250,"度"},{1175,125,""}, {1175,250,"的"},{1318,250,""},{880,500,"你\n"},
{880,250,"滴"},{1046,250,"滴"},{988,500,"清"},{988,500,"纯的"},
{1318,500,"蒸"},{1318,500,"馏"},{1046,2500,"⽔"},};
main()
{
int i;
//结构体数组的长度sizeof(t)/sizeof(STU)得到,总结构体数组⼤⼩ / 单个结构体⼤⼩
for(i=0; i<sizeof(t)/sizeof(STU); i++)
{
printf("%s",t[i].text);
Beep(t[i].freq,t[i].duration);
}
}
3.《来跳舞》
//Beep()函数,头⽂件windows.h
//函数内容(赫兹,持续时间)
#include<stdio.h>
#include<windows.h>
typedef struct
{
int freq;//赫兹
int duration;//持续时间
char text[32];//⽂本内容
}STU;
STU
t[]={{880,250,"送"},{880,250,"你"},{880,250,"雪"},{880,250,"⽩"},{880,250,"的"},{988,125,"云"},{880,125,""},{784,250,"朵"},{659,125,""}, {988,250,"送"},{988,250,"你"},{988,250,"璀"},{1046,250,"璨"},{988,250,"的"},{880,250,"星"},{880,500,"河\n"},
{880,250,"送"},{880,250,"你"},{880,250,"暖"},{880,250,"暖"},{880,250,"的"},{988,125,"春"},{880,125,""},{784,250,"风"},{659,125,""}, {988,250,"送"},{988,250,"你"},{988,250,"红"},{1046,250,"红"},{988,250,"的"},{880,250,"⼭"},{880,500,"果\n"},
{880,250,"送"},{880,250,"你"},{880,250,"不"},{880,250,"败"},{880,250,"的"},{988,125,"花"},{880,125,""},{784,250,"朵"},{659,125,""}, {988,250,"送"},{988,250,"你"},{988,250,"万"},{1046,250,"顷"},{988,250,"的"},{880,250,"⼭"},{880,500,"河\n"},
{880,250,"想"},{880,250,"问"},{880,250,"你"},{880,250,"的"},{880,250,"⼀"},{988,125,"颗"},{880,125,""},{784,250,"星"},{659,125,""}, {988,250,"什"},{988,250,"么"},{988,250,"时"},{1046,250,"候"},
{988,250,"送"},{880,250,"给"},{880,500,"我\n"},
{880,250,"骑"},{880,250,"上"},{880,250,"我"},{880,250,"的"},{880,250,"⼩"},{988,125,"骆"},{880,125,""},{784,250,"驼"},{659,125,""}, {988,250,"带"},{988,250,"你"},{988,250,"去"},{1046,250,"看"},{988,250,"⽇"},{880,250,"不"},{880,500,"落\n"},
{1046,250,"披"},{1046,250,"上"},{1046,250,"我"},{1318,250,"的"},{1568,250,"查"},{1318,250,"尔"},{1318,250,"⽡"},{1175,250,""},
{988,250,"带"},{988,250,"你"},{988,250,"巡"},{1046,250,"游"},{988,250,"我"},{880,250,"部"},{880,500,"落\n"},
{880,250,"弹"},{880,250,"起"},{880,250,"我"},{880,250,"的"},{880,250,"⼩"},{988,125,"⽉"},{880,125,""},{784,250,"琴"},{659,125,""}, {988,250,"为"},{988,250,"你"},{988,250,"唱"},{1046,250,"⾸"},{988,250,"⼩"},{880,250,"情"},{880,500,"歌\n"},
{880,250,"让"},{880,250,"我"},{880,250,"醉"},{880,250,"的"},{880,250,"不"},{988,125,"是"},{880,125,""},{784,250,"酒"},{659,125,""}, {988,250,"只"},{988,250,"是"},{988,250,"你"},{1046,250,"的"},{988,250,"⼩"},{880,250,"酒"},{880,500,"窝\n"},
html播放音乐代码
{1046,500,"欧"},{1046,250,"啦"},{1318,250,"啦"},{988,250,"欧"},{988,250,"啦"},{988,250,"啦"},{880,250,""},
{784,500,"欧"},{784,250,"啦"},{988,250,"啦"},{880,250,"啦"},{880,250,"啦"},{880,500,"啦\n"},
{1046,500,"欧"},{1046,250,"啦"},{1318,250,"啦"},{1568,250,"欧"},{1318,250,"啦"},{1318,250,"啦"},{1175,250,""},
{988,500,"欧"},{988,250,"啦"},{1046,250,"啦"},{988,250,"啦"},{880,250,"啦"},{880,500,"啦\n"},
{1046,500,"欧"},{1046,250,"啦"},{1318,250,"啦"},{988,250,"欧"},{988,250,"啦"},{988,250,"啦"},{880,250,""},
{784,500,"欧"},{784,250,"啦"},{988,250,"啦"},{880,250,"啦"},{880,250,"啦"},{880,500,"啦\n"},
{1046,500,"欧"},{1046,250,"啦"},{1318,250,"啦"},{1568,250,"欧"},{1318,250,"啦"},{1318,250,"啦"},{1175,250,""},
{988,500,"欧"},{988,250,"啦"},{1046,250,"啦"},{988,250,"啦"},{880,250,"啦"},{880,500,"啦\n"},
{880,250,"⾼"},{880,250,"⼭"},{880,250,"流"},{1046,250,"⽔"},{1318,500,"恰"},{1318,500,"恰"},
{1770,250,"雪"},{1568,250,"⼭"},{1318,250,"雪"},{1568,250,"地"},{1318,500,"恰"},{1318,500,"恰\n"},
{1318,250,"世"},{1318,250,"上"},{1318,250,"的"},{1568,250,"⼈"},{1175,250,"这"},{1175,250,"么"},{1175,250,"多"},{1046,250,""},
{988,250,"恰"},{880,250,"好"},{880,250,"是"},{784,250,"你"},{880,500,"恰"},{880,500,"恰\n"},
{880,250,"清"},{880,250,"风"},{880,250,"明"},{1046,250,"⽉"},{1318,500,"恰"},{1318,500,"恰"},
{1770,250,"草"},{1568,250,"原"},{1318,250,"骏"},{1568,250,"马"},{1318,500,"恰"},{1318,500,"恰\n"},
{1318,250,"世"},{1318,250,"上"},{1318,250,"的"},{1568,250,"⼈"},{1175,250,"这"},{1175,250,"么"},{1175,250,"多"},{1046,250,""},
{988,250,"恰"},{880,250,"好"},{880,250,"是"},{784,250,"你"},{880,500,"恰"},{880,500,"恰\n"},
};
main()
{
int i;
//结构体数组的长度sizeof(t)/sizeof(STU)得到,总结构体数组⼤⼩ / 单个结构体⼤⼩
for(i=0; i<sizeof(t)/sizeof(STU); i++)
{
printf("%s",t[i].text);
Beep(t[i].freq,t[i].duration);
}
}
就是这些,⼤家可以复制下来运⾏⼀下视听效果。

版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系QQ:729038198,我们将在24小时内删除。