曲子是大佬王宗贤的《孔雀之舞》,网上没有找到五线谱,只有简谱,而且曲子速度不明确。通过相关演奏音乐的可大体得知,因为连音较多,至10个小节处为24秒,所以每个小节是2.4秒,因为是2/4拍,每个小节是2拍,所以每半个拍子对应的时长是0.6秒,对应的是一个八分音符的音长,600毫秒在函数中用变量f控制。一个十六分音符的音长为300毫秒,一个四分音符的音长为1200毫秒。高音频率翻倍,低音频率减半。
1 #include<stdio.h> 2 #include<windows.h> 3 #include<math.h> 4 void main() 5 { 6 int f=590; 7 8 int dao=261*2,re=293*2,mi=329*2,fa=349*2,so=392*2,la=440*2,si=493*2; 9 10 printf("纯音乐,敬请欣赏"); 11 12 Beep(mi,f);Beep(la*0.5,f);Beep(dao,f*1.5);Beep(re,f*0.5);/**/ 13 14 Beep(mi,f*3);Beep(so,f);/**/ 15 16 Beep(re,f);Beep(mi,f);Beep(la*0.5,f);Beep(dao,f*0.5);Beep(mi,f*0.5);/**/ 17 18 Beep(re,f*3);Beep(mi,f*0.5);Beep(dao,f*0.5);/**/ 19 20 Beep(re,f);Beep(so*0.5,f);Beep(la*0.5,f*1.5);Beep(so,f*0.5);/**/ 21 22 Beep(re,f*3);Beep(re,f*0.5);Beep(mi,f*0.5);/**/ 23 24 Beep(so*0.5,f*0.5);Beep(la,f*0.5);Beep(so*0.5,f*0.5);Beep(la*0.5,f*0.5);Beep(re,f);Beep(dao,f*0.5);Beep(la*0.5,f*0.5);/**/ 25 26 Beep(dao,f*4);/**/ 27 28 Beep(dao,f);Beep(re,f);Beep(mi,f);Beep(so,f);/**/ 29 30 Beep(mi,f);Beep(la*0.5,f);Beep(dao,f*1.5);Beep(re,f*0.5);/**/ 31 32 Beep(mi,f*3);Beep(so,f);/**/ 33 34 Beep(re,f);Beep(mi,f);Beep(la*0.5,f);Beep(dao,f*0.5);Beep(mi,f*0.5);/**/ 35 36 Beep(re,f*3);Beep(mi,f*0.5);Beep(dao,f*0.5);/**/ 37 38 Beep(re,f);Beep(so*0.5,f);Beep(la*0.5,f*1.5);Beep(so,f*0.5);/**/ 39 40 Beep(re,f*3);Beep(re,f*0.5);Beep(mi,f*0.5);/**/ 41 42 Beep(so*0.5,f*0.5);Beep(la,f*0.5);Beep(so*0.5,f*0.5);Beep(la*0.5,f*0.5);Beep(re,f);Beep(dao,f*0.5);Beep(la*0.5,f*0.5);/**/ 43 44 Beep(dao,f*4);/**/ 45 46 Beep(re,f*1.5);Beep(dao,f*0.5);Beep(la*0.5,f);Beep(mi,f);/**/ 47 48 Beep(re,f*0.5);Beep(so,f*0.5);Beep(mi,f*0.5);Beep(dao,f*0.5);Beep(re,f*2);/**/ 49 50 Beep(dao,f);Beep(dao,f*0.5);Beep(la*0.5,f*0.5);Beep(so*0.5,f);Beep(re,f);/**/ 51 52 Beep(dao,f*0.5);Beep(re,f*0.5);Beep(so*0.5,f*0.5);Beep(la*0.5,f*0.5);Beep(dao,f);Beep(la*0.5,f*0.5);Beep(so*0.5,f*0.5);/**/ 53 54 Beep(re,f*1.5);Beep(dao,f*0.5);Beep(la*0.5,f);Beep(mi,f);/**/ 55 56 Beep(re,f*0.5);Beep(mi,f*0.5);Beep(la*0.5,f*0.5);Beep(dao,f*0.5);Beep(re,f);Beep(so,f*0.5);Beep(mi,f*0.5);/**/ 57 58 Beep(so,f*1.5);Beep(la,f*0.5);Beep(so,f);Beep(mi,f);/**/ 59 60 Beep(re,f*4);/**/ 61 62 Beep(mi,f);Beep(la*0.5,f);Beep(dao,f*1.5);Beep(re,f*0.5);/**/ 63 64 Beep(mi,f*3);Beep(so,f);/**/ 65 66 Beep(re,f);Beep(mi,f);Beep(la*0.5,f);Beep(dao,f*0.5);Beep(mi,f*0.5);/**/ 67 68 Beep(re,f*3);Beep(dao,f*0.5);Beep(mi,f*0.5);/**/ 69 70 Beep(re,f);Beep(so*0.5,f);Beep(la*0.5,f*1.5);Beep(so,f*0.5);/**/ 71 72 Beep(re,f*3);Beep(re,f*0.5);Beep(mi,f*0.5);/**/ 73 74 Beep(so*0.5,f*0.5);Beep(la,f*0.5);Beep(so*0.5,f*0.5);Beep(la*0.5,f*0.5);Beep(re,f);Beep(dao,f*0.5);Beep(la*0.5,f*0.5);/**/ 75 76 Beep(dao,f*4);/**/ 77 78 Beep(re,f*1.5);Beep(dao,f*0.5);Beep(la*0.5,f);Beep(mi,f);/**/ 79 80 Beep(re,f*0.5);Beep(so,f*0.5);Beep(mi,f*0.5);Beep(dao,f*0.5);Beep(re,f*2);/**/ 81 82 Beep(dao,f);Beep(dao,f*0.5);Beep(la*0.5,f*0.5);Beep(so*0.5,f);Beep(re,f);/**/ 83 84 Beep(dao,f*0.5);Beep(re,f*0.5);Beep(so*0.5,f*0.5);Beep(la*0.5,f*0.5);Beep(dao,f);Beep(la*0.5,f*0.5);Beep(so*0.5,f*0.5);/**/ 85 86 Beep(re,f*1.5);Beep(dao,f*0.5);Beep(la*0.5,f);Beep(mi,f);/**/ 87 88 Beep(re,f*0.5);Beep(mi,f*0.5);Beep(la*0.5,f*0.5);Beep(dao,f*0.5);Beep(re,f);Beep(so,f*0.5);Beep(mi,f*0.5);/**/ 89 90 Beep(so,f*1.5);Beep(la,f*0.5);Beep(so,f);Beep(mi,f);/**/ 91 92 Beep(re,f*1.5);Beep(dao,f*0.5);Beep(re*2,f);Beep(re*2,f);/**/ 93 94 Beep(dao*2,f);Beep(si,f);Beep(so,f*1.5);Beep(la,f*0.5);/**/ 95 96 Beep(mi,f*4);/**/ 97 98 Beep(la*0.5,f);Beep(dao,f);Beep(mi,f*1.5);Beep(la,f*0.5);/**/ 99 100 Beep(so,f*1.5);Beep(la,f*0.5);Beep(re,f*2);/**/ 101 102 Beep(la*0.5,f);Beep(so*0.5,f);Beep(la*0.5,f);Beep(mi,f);/**/ 103 104 Beep(re,f*3);Beep(mi,f);/**/ 105 106 Beep(so,f);Beep(la,f);Beep(re,f*2);/**/ 107 108 Beep(la*0.5,f*8);/**/ 109 }
标签:la,mi,dao,0.5,C语言,Beep,re,歌曲 From: https://www.cnblogs.com/xiaosongshu2023/p/17838644.html