وبلاگ رسمی علیرضا شهامت در بلاگ اسکای

وبلاگ رسمی علیرضا شهامت در بلاگ اسکای

وبلاگ رسمی علیرضا شهامت در بلاگ اسکای - تأسیس شده در سال 1396
وبلاگ رسمی علیرضا شهامت در بلاگ اسکای

وبلاگ رسمی علیرضا شهامت در بلاگ اسکای

وبلاگ رسمی علیرضا شهامت در بلاگ اسکای - تأسیس شده در سال 1396

Musical Beep - بوق یا بیپ موسیقایی - کدها

001  Musical Beep
Path =  ...\l\Crt\mm\C#8X\Snd\Beep\1398\01 14 1520\Beep


using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace ConsoleApplication1
{


    public class Program
    {




        public static void Music_001()
        {

            int frequency = 20;
            int duration = 500;

            ////////////////////////////////////////////
            frequency = 400;
            duration = 500;

            Console.Beep(frequencyduration);
            ////////////////////////////////////////////


            ////////////////////////////////////////////
            frequency = (int)(400 * (1d + (1d / 7d)));
            duration = 500;

            Console.Beep(frequencyduration);
            ////////////////////////////////////////////

            ////////////////////////////////////////////
            frequency = (int)(400 * (1d + (2d / 7d)));
            duration = 500;

            Console.Beep(frequencyduration);
            ////////////////////////////////////////////

            ////////////////////////////////////////////
            frequency = (int)(400 * (1d + (3d / 7d)));
            duration = 500;

            Console.Beep(frequencyduration);
            ////////////////////////////////////////////

            ////////////////////////////////////////////
            frequency = (int)(400 * (1d + (4d / 7d)));
            duration = 500;

            Console.Beep(frequencyduration);
            ////////////////////////////////////////////


            ////////////////////////////////////////////
            frequency = (int)(400 * (1d + (5d / 7d)));
            duration = 500;

            Console.Beep(frequencyduration);
            ////////////////////////////////////////////


            ////////////////////////////////////////////
            frequency = (int)(400 * (1d + (6d / 7d)));
            duration = 500;

            Console.Beep(frequencyduration);
            ////////////////////////////////////////////


            ////////////////////////////////////////////
            frequency = (int)(400 * (2d + (0d / 7d)));
            duration = 500;

            Console.Beep(frequencyduration);
            ////////////////////////////////////////////


            ////////////////////////////////////////////
            frequency = (int)(400 * (2d + (1d / 7d)));
            duration = 500;

            Console.Beep(frequencyduration);
            ////////////////////////////////////////////



        }

        public static void Music_002()
        {

            int base_freq = 400;
            double octave = 1d;
            double x7om = 0d;
            double x14om = 0d;

            double base_freq_step = 400d * (1d / 14d);

            int frequency;
            int duration;


            for (base_freq = 400base_freq <= 800base_freq = (int)(base_freq + base_freq_step))
            {
                for (octave = 1doctave <= 6doctave += 1d)
                {
                    for (x7om = 0dx7om <= 6dx7om += 1d)
                    {

                        for (x14om = 0dx14om <= 1dx14om += 1d)
                        {

                            frequency = (int)(base_freq * (octave + (x7om / 7d+ (x14om / 14d)));
                            duration = 150;
                            Console.Beep(frequencyduration);
                        }
                    }
                }
            }



        }




        public static void Music_003()
        {

            int base_freq = 400;
            double octave = 1d;
            double x7om = 0d;
            double x14om = 0d;

            double base_freq_step = 400d * (1d / 14d);

            int frequency;
            int duration;


            //for (base_freq = 400; base_freq <= 800; base_freq = (int)(base_freq + base_freq_step))
            //{
            //    for (octave = 1d; octave <= 6d; octave += 1d)
            //    {
            //        for (x7om = 0d; x7om <= 6d; x7om += 1d)
            //        {

            //            for (x14om = 0d; x14om <= 13d; x14om += 1d)
            //            {

            //                frequency = (int)(base_freq * (octave + (x7om / 7d) + (x14om / 14d)));
            //                duration = 150;
            //                Console.Beep(frequency, duration);
            //            }
            //        }
            //    }
            //}

            ////////////////////////////////////////////////////

            base_freq = 400;
            octave = +1d;
            x7om = +5d;
            x14om = +0d;

            frequency = (int)(base_freq * (octave + (x7om / 7d+ (x14om / 14d)));
            duration = 750;
            Console.Beep(frequencyduration);

            ////////////////////////////////////////////////////


            base_freq = 400;
            octave = +1d;
            x7om = +5d;
            x14om = +0d;

            frequency = (int)(base_freq * (octave + (x7om / 7d+ (x14om / 14d)));
            duration = 750;
            Console.Beep(frequencyduration);

            ////////////////////////////////////////////////////

            ////////////////////////////////////////////////////


            base_freq = 400;
            octave = +1d;
            x7om = +6d;
            x14om = +0d;

            frequency = (int)(base_freq * (octave + (x7om / 7d+ (x14om / 14d)));
            duration = 750;
            Console.Beep(frequencyduration);

            ////////////////////////////////////////////////////

            ////////////////////////////////////////////////////


            base_freq = 400;
            octave = +2d;
            x7om = +0d;
            x14om = +0d;

            frequency = (int)(base_freq * (octave + (x7om / 7d+ (x14om / 14d)));
            duration = 750;
            Console.Beep(frequencyduration);

            ////////////////////////////////////////////////////


        }





        public static void Play_Note(
            int base_freq,
            double octave,
            double x7om,
            double x14om,
            int duration
        )
        {

            ////////////////////////////////////////////////////

            int frequency = (int)(base_freq * (octave + (x7om / 7d+ (x14om / 14d)));

            Console.Beep(frequencyduration);

            ////////////////////////////////////////////////////


        }


        public static void Music_004()
        {



            // public static void Play_Note( int base_freq , double octave , double x7om , double x14om , int duration )

            int bf01 = 480;

            int bf_Silence = 37;


            Play_Note(bf01+1d+5d+0d1000);
            Play_Note(bf_Silence+1d+0d+0d500);

            Play_Note(bf01+1d+5d+0d1000);
            Play_Note(bf_Silence+1d+0d+0d500);

            Play_Note(bf01+1d+4d+0d1000);
            Play_Note(bf_Silence+1d+0d+0d500);

            Play_Note(bf01+1d+3d+0d1000);
            Play_Note(bf_Silence+1d+0d+0d500);

            Play_Note(bf01+1d+6d+1d1500);
            Play_Note(bf_Silence+1d+0d+0d10);
            Play_Note(700+1d+5d+1d1500);


            Play_Note(bf01+1d+5d+0d1500);
            Play_Note(bf_Silence+1d+0d+0d500);

            Play_Note(bf01+1d+4d+0d1000);
            Play_Note(bf_Silence+1d+0d+0d10);
            


        }


        static void Main(string[] args)
        {

            int frequency = 20;
            int duration;


            double theta2;
            int radius_max;
            int radius;
            int frequency_min;
            int frequency_max;

            //Music_001();

            //Music_002();

            //Music_003();

            Music_004();



            Console.ReadLine();

        }
    }
}













//////////////////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////////////////



Path 2 = ...\l\Crt\mm\VS\sln\C#\Snd\1398 09 27\2003\Beep
Codes:

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace ConsoleApplication1
{


    public class Program
    {




        public static void Music_001()
        {

            int frequency = 20;
            int duration = 500;

            ////////////////////////////////////////////
            frequency = 400;
            duration = 500;

            Console.Beep(frequencyduration);
            ////////////////////////////////////////////


            ////////////////////////////////////////////
            frequency = (int)(400 * (1d + (1d / 7d)));
            duration = 500;

            Console.Beep(frequencyduration);
            ////////////////////////////////////////////

            ////////////////////////////////////////////
            frequency = (int)(400 * (1d + (2d / 7d)));
            duration = 500;

            Console.Beep(frequencyduration);
            ////////////////////////////////////////////

            ////////////////////////////////////////////
            frequency = (int)(400 * (1d + (3d / 7d)));
            duration = 500;

            Console.Beep(frequencyduration);
            ////////////////////////////////////////////

            ////////////////////////////////////////////
            frequency = (int)(400 * (1d + (4d / 7d)));
            duration = 500;

            Console.Beep(frequencyduration);
            ////////////////////////////////////////////


            ////////////////////////////////////////////
            frequency = (int)(400 * (1d + (5d / 7d)));
            duration = 500;

            Console.Beep(frequencyduration);
            ////////////////////////////////////////////


            ////////////////////////////////////////////
            frequency = (int)(400 * (1d + (6d / 7d)));
            duration = 500;

            Console.Beep(frequencyduration);
            ////////////////////////////////////////////


            ////////////////////////////////////////////
            frequency = (int)(400 * (2d + (0d / 7d)));
            duration = 500;

            Console.Beep(frequencyduration);
            ////////////////////////////////////////////


            ////////////////////////////////////////////
            frequency = (int)(400 * (2d + (1d / 7d)));
            duration = 500;

            Console.Beep(frequencyduration);
            ////////////////////////////////////////////



        }

        public static void Music_002()
        {

            int base_freq = 400;
            double octave = 1d;
            double x7om = 0d;
            double x14om = 0d;

            double base_freq_step = 400d * (1d / 14d);

            int frequency;
            int duration;


            for (base_freq = 400base_freq <= 800base_freq = (int)(base_freq + base_freq_step))
            {
                for (octave = 1doctave <= 6doctave += 1d)
                {
                    for (x7om = 0dx7om <= 6dx7om += 1d)
                    {

                        for (x14om = 0dx14om <= 1dx14om += 1d)
                        {

                            frequency = (int)(base_freq * (octave + (x7om / 7d+ (x14om / 14d)));
                            duration = 150;
                            Console.Beep(frequencyduration);
                        }
                    }
                }
            }



        }




        public static void Music_003()
        {

            int base_freq = 400;
            double octave = 1d;
            double x7om = 0d;
            double x14om = 0d;

            double base_freq_step = 400d * (1d / 14d);

            int frequency;
            int duration;


            //for (base_freq = 400; base_freq <= 800; base_freq = (int)(base_freq + base_freq_step))
            //{
            //    for (octave = 1d; octave <= 6d; octave += 1d)
            //    {
            //        for (x7om = 0d; x7om <= 6d; x7om += 1d)
            //        {

            //            for (x14om = 0d; x14om <= 13d; x14om += 1d)
            //            {

            //                frequency = (int)(base_freq * (octave + (x7om / 7d) + (x14om / 14d)));
            //                duration = 150;
            //                Console.Beep(frequency, duration);
            //            }
            //        }
            //    }
            //}

            ////////////////////////////////////////////////////

            base_freq = 400;
            octave = +1d;
            x7om = +5d;
            x14om = +0d;

            frequency = (int)(base_freq * (octave + (x7om / 7d+ (x14om / 14d)));
            duration = 750;
            Console.Beep(frequencyduration);

            ////////////////////////////////////////////////////


            base_freq = 400;
            octave = +1d;
            x7om = +5d;
            x14om = +0d;

            frequency = (int)(base_freq * (octave + (x7om / 7d+ (x14om / 14d)));
            duration = 750;
            Console.Beep(frequencyduration);

            ////////////////////////////////////////////////////

            ////////////////////////////////////////////////////


            base_freq = 400;
            octave = +1d;
            x7om = +6d;
            x14om = +0d;

            frequency = (int)(base_freq * (octave + (x7om / 7d+ (x14om / 14d)));
            duration = 750;
            Console.Beep(frequencyduration);

            ////////////////////////////////////////////////////

            ////////////////////////////////////////////////////


            base_freq = 400;
            octave = +2d;
            x7om = +0d;
            x14om = +0d;

            frequency = (int)(base_freq * (octave + (x7om / 7d+ (x14om / 14d)));
            duration = 750;
            Console.Beep(frequencyduration);

            ////////////////////////////////////////////////////


        }





        public static void Play_Note(
            int base_freq,
            double octave,
            double x7om,
            double x14om,
            int duration
        )
        {

            ////////////////////////////////////////////////////

            Console.Write("\n  int frequency = (int)");
            Console.Write("\n  (");
            Console.Write("\n  base_freq * (octave + (x7om / 7d) + (x14om / 14d))");
            Console.Write("\n  );  \n\n");


            int frequency = (int)
                (
                base_freq * (octave + (x7om / 7d+ (x14om / 14d))
                );


            Console.Write("\n\n\n  base_freq = " + base_freq);
            Console.Write(" , octave = " + octave);
            Console.Write(" , x7om = " + x7om);
            Console.Write(" , x14om = " + x14om);

            Console.Write("\n\n  frequency = " + frequency);
            Console.Write(" , duration = " + duration);

            Console.Write("\n\n");




            Console.Beep(frequencyduration);

            

            ////////////////////////////////////////////////////


        }


        public static void Music_004()
        {



            // public static void Play_Note( int base_freq , double octave , double x7om , double x14om , int duration )

            int bf01 = 670;

            int bf_Silence = 37;


            Play_Note(bf01+1d+5d+0d1000);
            Play_Note(bf_Silence+1d+0d+0d500);

            Play_Note(bf01+1d+5d+0d1000);
            Play_Note(bf_Silence+1d+0d+0d500);

            Play_Note(bf01+1d+4d+0d1000);
            Play_Note(bf_Silence+1d+0d+0d500);

            Play_Note(bf01+1d+3d+0d1000);
            Play_Note(bf_Silence+1d+0d+0d500);

            Play_Note(bf01+1d+6d+1d1500);
            Play_Note(bf_Silence+1d+0d+0d10);
            Play_Note(bf01+1d+6d+1d1500);


            Play_Note(bf01+1d+5d+0d1500);
            Play_Note(bf_Silence+1d+0d+0d300);

            Play_Note(bf01+1d+4d+0d1000);
            Play_Note(bf_Silence+1d+0d+0d10);



        }


        public static void Music_005()
        {

            // public static void Play_Note( int base_freq , double octave , double x7om , double x14om , int duration )

            int bf01 = 600;

            int bf_Silence = 37;


            Play_Note(bf01+1d+0d+0d500);
            Play_Note(bf_Silence+1d+0d+0d500);
            Play_Note(bf01+1d+2d+0d500);




        }




        public static void Music_006()
        {

            // public static void Play_Note( int base_freq , double octave , double x7om , double x14om , int duration )

            int bf01 = 600;

            int bf_Silence = 37;


            Play_Note(bf_Silence+1d+0d+0d2500);

            Play_Note(bf01+1d+0d+0d500);
            Play_Note(bf_Silence+1d+0d+0d500);
            Play_Note(bf01+1d+2d+0d500);
            Play_Note(bf_Silence+1d+0d+0d500);
            Play_Note(bf01+1d+3d+0d500);


            Play_Note(bf01+1d+0d+0d500);
            Play_Note(bf_Silence+1d+0d+0d250);
            Play_Note(bf01+1d+2d+0d500);
            Play_Note(bf_Silence+1d+0d+0d250);
            Play_Note(bf01+1d+3d+0d500);



            Play_Note(bf01+1d+0d+0d500);
            //Play_Note(bf_Silence, +1d, +0d, +0d, 100);
            Play_Note(bf01+1d+2d+0d500);
            //Play_Note(bf_Silence, +1d, +0d, +0d, 100);
            Play_Note(bf01+1d+3d+0d500);
            Play_Note(bf01+1d+3d+0d500);
            Play_Note(bf01+1d+2d+0d500);
            Play_Note(bf01+1d+0d+0d500);



            Play_Note(bf01+2d+0d+0d500);
            Play_Note(bf01+2d-8d+0d500);
            Play_Note(bf01+1d+3d+0d500);
            Play_Note(bf01+1d+3d+0d500);
            Play_Note(bf01+1d+2d+0d500);
            Play_Note(bf01+1d+0d+0d500);



            //  ************************* \\

            Play_Note(bf01+2d+7d+0d500);

            Play_Note(bf01+2d+6d+1d500);
            Play_Note(bf01+2d+6d+0d500);

            Play_Note(bf01+2d+5d+1d500);
            Play_Note(bf01+2d+5d+0d500);

            Play_Note(bf01+2d+4d+1d500);
            Play_Note(bf01+2d+4d+0d500);

            Play_Note(bf01+2d+3d+1d500);
            Play_Note(bf01+2d+3d+0d500);

            Play_Note(bf01+2d+2d+1d500);
            Play_Note(bf01+2d+2d+0d500);
            
            Play_Note(bf01+2d+1d+1d500);
            Play_Note(bf01+2d+1d+0d500);

            Play_Note(bf01+2d+0d+1d500);
            Play_Note(bf01+2d+0d+0d500);

            Play_Note(bf01+2d-1d+1d500);
            Play_Note(bf01+2d-1d+0d500);

            Play_Note(bf01+2d-2d+1d500);
            Play_Note(bf01+2d-2d+0d500);

            Play_Note(bf01+2d-3d+1d500);
            Play_Note(bf01+2d-3d+0d500);

            Play_Note(bf01+2d-4d+1d500);
            Play_Note(bf01+2d-4d+0d500);

            Play_Note(bf01+2d-5d+1d500);
            Play_Note(bf01+2d-5d+0d500);
            
            Play_Note(bf01+2d-6d+1d500);
            Play_Note(bf01+2d-6d+0d500);

            Play_Note(bf01+2d-7d+1d500);
            Play_Note(bf01+2d-7d+0d500);
            
            Play_Note(bf01+2d-8d+1d500);
            Play_Note(bf01+2d-8d+0d500);

            Play_Note(bf01+2d-9d+1d500);
            Play_Note(bf01+2d-9d+0d500);
            
            Play_Note(bf01+2d-10d+1d500);
            Play_Note(bf01+2d-10d+0d500);

            Play_Note(bf01+2d-11d+1d500);
            Play_Note(bf01+2d-11d+0d500);


            //  ************************* \\


        }



        public static void Music_007()
        {

            // public static void Play_Note( int base_freq , double octave , double x7om , double x14om , int duration )

            int bf01 = 600;

            int bf_Silence = 37;



            Play_Note(bf_Silence+1d+0d+0d2500);



            //  ************************* \\

            double i_max;
            i_max = +120d;

            double i_min;
            i_min = -1d;

            int du;
            du = 100;

            for (double i =i_maxi >= i_mini -= 1d)
            {



                Play_Note(bf01+1di+1ddu);
                Play_Note(bf01+1di+0ddu);

                Play_Note(bf_Silence+1d0d+0ddu);

                Play_Note(bf01+1di_max - i+1ddu);
                Play_Note(bf01+1di_max - i+0ddu);

                Play_Note(bf_Silence+1d0d+0ddu);


            }
            


            //  ************************* \\


        }


        static void Main(string[] args)
        {



            //int frequency = 20;
            //int duration;


            //double theta2;
            //int radius_max;
            //int radius;
            //int frequency_min;
            //int frequency_max;








            //Music_001();

            //Music_002();

            //Music_003();

            //Music_004();

            //Music_005();

            Music_007();



            Console.Write("\n\n\n  int frequency = (int)");
            Console.Write("\n  (");
            Console.Write("\n  base_freq * (octave + (x7om / 7d) + (x14om / 14d))");
            Console.Write("\n  );  \n\n\n");



            Console.ReadLine();

        }
    }
}



نظرات 0 + ارسال نظر
برای نمایش آواتار خود در این وبلاگ در سایت Gravatar.com ثبت نام کنید. (راهنما)
ایمیل شما بعد از ثبت نمایش داده نخواهد شد