Example #1
0
 public string this[MusicalNotes.Notes e, int octaveoffset]
 {
     set
     {
         Tabs.Add(
             new Tab
             {
                 Note = e,
                 Stream = value,
                 OctaveOffset = octaveoffset
             }
         );
     }
 }
Example #2
0
        public void Play(MusicalNotes.Notes note, char octave, int octaveoffset)
        {
            var n = 0;

            if (octave == '0') n = 0;
            else if (octave == '1') n = 1;
            else if (octave == '2') n = 2;
            else if (octave == '3') n = 3;
            else if (octave == '4') n = 4;
            else if (octave == '5') n = 5;
            else if (octave == '6') n = 6;
            else if (octave == '7') n = 7;
            else return;

            this.Notes.Beep(note, n + octaveoffset);
        }
Example #3
0
        public GuitarTabs(MusicalNotes Notes,
                          string E_,
                          string B,
                          string G,
                          string D,
                          string A,
                          string E)
        {
            this.Notes = Notes;

            this[MusicalNotes.Notes.E, 1] = E_;
            this[MusicalNotes.Notes.B, 0] = B;
            this[MusicalNotes.Notes.G, 0] = G;
            this[MusicalNotes.Notes.D, 0] = D;
            this[MusicalNotes.Notes.A, 0] = A;
            this[MusicalNotes.Notes.E, 0] = E;
        }
Example #4
0
        public static int main()
        {
            Console.WriteLine("20141104 does this device support speaker music?");

            // you really should not use headphones with PC speakers
            Console.Beep();
            JaggedArrayTest();

            var m = new MusicalNotes();

            var intro1 = new GuitarTabs(m,
                                        "---------0-------]---------0-------]---------0-------]---------0-------]",
                                        "-----------0-----]-----------3-----]-----3-----3---3-]-----3-----3---3-]",
                                        "-------0-----0---]-------0-----0---]---2---2-----2---]---2---2-----2---]",
                                        "-----2---------0-]-----0---------0-]-0---------------]-0---------------]",
                                        "---2-------------]---2-------------]-----------------]-----------------]",
                                        "-0---------------]-3---------------]-----------------]-----------------]"
                                        );

            var intro2 = new GuitarTabs(m,
                                        "---------0-------]---------0-------]---------0-------]---------0-------]",
                                        "-----3-----3---3-]-----3-----3---3-]-----0-----0---0-]-----0-----0---0-]",
                                        "-------0-----0---]-------0-----0---]-------2-----2---]-------2-----2---]",
                                        "---2-------------]---2-------------]---2-------------]---2-------------]",
                                        "-3---------------]-3---------------]-0---------------]-0---------------]",
                                        "-----------------]-----------------]-----------------]-----------------]"
                                        );


            // http://www.guitaretab.com/l/limp-bizkit/25879.html

            for (int i = 0; i < 100; i++)
            {
                var x = i * Math.PI / 100;
                int y = (int)(Math.Sin(x) * 400);

                Console.Beep(800 + y, 30);
            }


            intro1.Play();
            intro2.Play();


            new ColoredText
            {
                Color = ConsoleColor.Green,
                Text  = "look, it is an object"
            }.ToConsole();
            // this object wont be garbage collected, so be careful for what you wish for.

            Console.ForegroundColor = ConsoleColor.Cyan;

            var pi = Math.PI;

            Console.Write(pi);
            Console.WriteLine();

            var param = 30;
            var pisin = Math.Sin(param * Math.PI / 180);

            Console.Write(pisin);
            Console.WriteLine();

            Console.ForegroundColor = ConsoleColor.Red;
            Console.WriteLine("[NativeClass1]");
            Console.ForegroundColor = ConsoleColor.Yellow;

            File.WriteAllText("log.txt", "this is the result");

            // we are safe to use the list until our
            // value type is not larger than the pointer
            var music = new List <int>
            {
                100,
                600,
                300,
                700,
                100,
                200,
                500,
                50,
                50,
                600
            };



            foreach (char c in "hello world. c# code has been converted to c code. and you are running it!")
            {
                Console.Beep(37 + c, 10);
                Console.Write(c);

                if (c == '.')
                {
                    Thread.Sleep(100);
                }
                else
                {
                    Thread.Sleep(20);
                }
            }

            Console.WriteLine();

            for (int r = 0; r < 2; r++)
            {
                for (int i = 0; i < music.Count; i++)
                {
                    var x = (int)music[i];

                    Console.Write(x);
                    Console.Write(" ");

                    Console.Beep(x, 50);
                    Thread.Sleep(20);
                }
            }



            Console.WriteLine("got music?");


            for (int i = 37; i < 1200; i += 100)
            {
                Console.Beep(i, 50);
                Thread.Sleep(20);
            }


            Console.Write('j');
            Console.Write('s');
            Console.Write('c');

            Console.Beep(1200, 200);

            return(0);
        }
Example #5
0
        public static int main()
        {
            Console.WriteLine("20141104 does this device support speaker music?");

            // you really should not use headphones with PC speakers
            Console.Beep();
            JaggedArrayTest();

            var m = new MusicalNotes();

            var intro1 = new GuitarTabs(m,
             "---------0-------]---------0-------]---------0-------]---------0-------]",
             "-----------0-----]-----------3-----]-----3-----3---3-]-----3-----3---3-]",
             "-------0-----0---]-------0-----0---]---2---2-----2---]---2---2-----2---]",
             "-----2---------0-]-----0---------0-]-0---------------]-0---------------]",
             "---2-------------]---2-------------]-----------------]-----------------]",
             "-0---------------]-3---------------]-----------------]-----------------]"
            );

            var intro2 = new GuitarTabs(m,
                "---------0-------]---------0-------]---------0-------]---------0-------]",
                "-----3-----3---3-]-----3-----3---3-]-----0-----0---0-]-----0-----0---0-]",
                "-------0-----0---]-------0-----0---]-------2-----2---]-------2-----2---]",
                "---2-------------]---2-------------]---2-------------]---2-------------]",
                "-3---------------]-3---------------]-0---------------]-0---------------]",
                "-----------------]-----------------]-----------------]-----------------]"
            );


            // http://www.guitaretab.com/l/limp-bizkit/25879.html

            for (int i = 0; i < 100; i++)
            {
                var x = i * Math.PI / 100;
                int y = (int)(Math.Sin(x) * 400);

                Console.Beep(800 + y, 30);
            }


            intro1.Play();
            intro2.Play();


            new ColoredText
            {
                Color = ConsoleColor.Green,
                Text = "look, it is an object"
            }.ToConsole();
            // this object wont be garbage collected, so be careful for what you wish for.

            Console.ForegroundColor = ConsoleColor.Cyan;

            var pi = Math.PI;

            Console.Write(pi);
            Console.WriteLine();

            var param = 30;
            var pisin = Math.Sin(param * Math.PI / 180);

            Console.Write(pisin);
            Console.WriteLine();

            Console.ForegroundColor = ConsoleColor.Red;
            Console.WriteLine("[NativeClass1]");
            Console.ForegroundColor = ConsoleColor.Yellow;

            File.WriteAllText("log.txt", "this is the result");

            // we are safe to use the list until our 
            // value type is not larger than the pointer
            var music = new List<int>
			{
				100,
				600,
				300,
				700,
				100,
				200,
				500,
				50,
				50,
				600
			};




            foreach (char c in "hello world. c# code has been converted to c code. and you are running it!")
            {
                Console.Beep(37 + c, 10);
                Console.Write(c);

                if (c == '.')
                    Thread.Sleep(100);
                else
                    Thread.Sleep(20);
            }

            Console.WriteLine();

            for (int r = 0; r < 2; r++)
            {
                for (int i = 0; i < music.Count; i++)
                {
                    var x = (int)music[i];

                    Console.Write(x);
                    Console.Write(" ");

                    Console.Beep(x, 50);
                    Thread.Sleep(20);
                }
            }



            Console.WriteLine("got music?");


            for (int i = 37; i < 1200; i += 100)
            {
                Console.Beep(i, 50);
                Thread.Sleep(20);
            }


            Console.Write('j');
            Console.Write('s');
            Console.Write('c');

            Console.Beep(1200, 200);

            return 0;
        }
Example #6
0
        public GuitarTabs(MusicalNotes Notes,
            string E_,
            string B,
            string G,
            string D,
            string A,
            string E)
        {

            this.Notes = Notes;

            this[MusicalNotes.Notes.E, 1] = E_;
            this[MusicalNotes.Notes.B, 0] = B;
            this[MusicalNotes.Notes.G, 0] = G;
            this[MusicalNotes.Notes.D, 0] = D;
            this[MusicalNotes.Notes.A, 0] = A;
            this[MusicalNotes.Notes.E, 0] = E;

        }