当前位置:编程学习 > C#/ASP.NET >>

C# 演奏月亮代表我的心

C# 演奏 月亮代表我的心
欢迎喜欢音乐的人与我一起交流

        //racket 定义节拍
            const int one = 600;//一拍
            const int half = 300;//半拍
            const int four_one = 150;//1/4拍
            const int onedot = 450;//附点音符
            ////note   定义音符
            //const int mnote1 = 440;//do
            //const int mnote2 = 495;//re
            //const int mnote3 = 550;//mi
            //const int mnote4 = 587;//fa
            //const int mnote5 = 660;//so
            //const int mnote6 = 733;//la
            //const int mnote7 = 825;//si

            //const int lnote5 = 325;

            #region
            //low note   低音区
            const int lnote1 = 262;
            const int lnote2 = 294;
            const int lnote3 = 330;
            const int lnote4 = 349;
            const int lnote5 = 392;
            const int lnote6 = 440;
            const int lnote7 = 494;
            //mid note   中音区
            const int mnote1 = 523;
            const int mnote2 = 578;
            const int mnote3 = 659;
            const int mnote4 = 698;
            const int mnote5 = 784;
            const int mnote6 = 880;
            const int mnote7 = 988;
            //hight note   高音区
            const int hnote1 = 1046;
            const int hnote2 = 1175;
            const int hnote3 = 1318;
            const int hnote4 = 1397;
            const int hnote5 = 1568;
            const int hnote6 = 1760;
            const int hnote7 = 1976;
            #endregion

            //月亮代表我的心
            Console.Beep(lnote5, half);

            Console.Beep(mnote1, onedot);
            Console.Beep(mnote3, half);
            Console.Beep(mnote5, onedot);
            Console.Beep(mnote1, half);

            Console.Beep(lnote7, onedot);
            Console.Beep(mnote3, half);
            Console.Beep(mnote5, onedot);
            Console.Beep(mnote5, half);


            Console.Beep(mnote6, onedot);
            Console.Beep(mnote7, half);
            Console.Beep(hnote1, onedot);
            Console.Beep(mnote6, half);

            Console.Beep(mnote5, one);
            System.Threading.Thread.Sleep(one);
            System.Threading.Thread.Sleep(one);
            Console.Beep(mnote3, half);
            Console.Beep(mnote2, half);

            Console.Beep(mnote1, onedot);
            Console.Beep(mnote1, half);
            Console.Beep(mnote1, half);
            Console.Beep(mnote1, one);
            Console.Beep(mnote3, half);
            Console.Beep(mnote2, half);

            Console.Beep(mnote1, onedot);
            Console.Beep(mnote1, half);
            Console.Beep(mnote1, half);
            Console.Beep(mnote1, one);
            Console.Beep(mnote2, half);
            Console.Beep(mnote3, half);


            Console.Beep(mnote2, onedot);
            Console.Beep(mnote1, half);
            Console.Beep(lnote6, one);
            Console.Beep(mnote2, half);
            Console.Beep(mnote3, half);

            Console.Beep(mnote2, one);
补充:软件开发 , C# ,
CopyRight © 2012 站长网 编程知识问答 www.zzzyk.com All Rights Reserved
部份技术文章来自网络,