Beispiel #1
0
        public void SoundAlarm()
        {
            var melody = new Tunes.Melody();

            melody.Add((int)C4, Quarter);
            melody.Add((int)F4, Quarter);
            melody.Add((int)C5, Half);

            _tunes.Play(melody);
        }
        private void AddNote(int note, int length, int octave)
        {
            // convert note into frequency
            double f = Octave1[note] * (1 << (octave - 1));

            // calculate duration in ms
            int ms = Tempo / length;

            // add to the melody
            //Console.WriteLine("{0} {1} {2} {3} {4}", note, length, octave, f, ms );
            melody.Add(new Tunes.Tone(f), ms);
        }
Beispiel #3
0
        public void PlayAlarm()
        {
            Tunes.MusicNote[] notes = new Tunes.MusicNote[5];

            Tunes.Melody melody = new Tunes.Melody();

            int start = 120;

            for (int i = 0; i < notes.Length; i++)
            {
                Tunes.Tone tone = new Tunes.Tone(start);
                notes[i] = new Tunes.MusicNote(tone, 100);
                start    = start + 10;
            }

            melody.Add(notes);
            Program.alarm.Play(melody);
        }
 // This will be the main loop.
 void timer_Tick(GT.Timer timer)
 {
     // Get the Joystick position.
     var joystickPosition = joystick.GetPosition();
     // Present the x-position as a LED turned on relative to the position
     led_Strip.TurnAllLedsOff();
     var positionAsLed = ((joystickPosition.X + 1.0) * 3.0).ToString("F0");
     Debug.Print(positionAsLed);
     //((joystickPosition.X + 1)*3.5).ToString("G")
     var led = int.Parse(positionAsLed);
     led_Strip.TurnLEDOn(led);
     // Present the y-position as a frequency on the tunes module
     var frequency = int.Parse( ((joystickPosition.Y + 1.0) * 1000.0).ToString("F0") );
     var melody = new Tunes.Melody();
     melody.Add(frequency, 50);
     tunes.Play(melody);
     // Get the Joystick button state
     // Present the joystick button state as the main board LED on/off
 }
Beispiel #5
0
        /// <summary>
        /// Testing method for Tunes module
        /// </summary>
        static void TestTunes()
        {
            var melody = new Tunes.Melody();

            Tunes.MusicNote note = new Tunes.MusicNote(Tunes.Tone.C4, 400);

            melody.Add(note);

            // up
            melody.Add(PlayNote(Tunes.Tone.C4));
            melody.Add(PlayNote(Tunes.Tone.D4));
            melody.Add(PlayNote(Tunes.Tone.E4));
            melody.Add(PlayNote(Tunes.Tone.F4));
            melody.Add(PlayNote(Tunes.Tone.G4));
            melody.Add(PlayNote(Tunes.Tone.A4));
            melody.Add(PlayNote(Tunes.Tone.B4));
            melody.Add(PlayNote(Tunes.Tone.C5));

            //// back down
            melody.Add(PlayNote(Tunes.Tone.B4));
            melody.Add(PlayNote(Tunes.Tone.A4));
            melody.Add(PlayNote(Tunes.Tone.G4));
            melody.Add(PlayNote(Tunes.Tone.F4));
            melody.Add(PlayNote(Tunes.Tone.E4));
            melody.Add(PlayNote(Tunes.Tone.D4));
            melody.Add(PlayNote(Tunes.Tone.C4));

            //// arpeggio
            melody.Add(PlayNote(Tunes.Tone.E4));
            melody.Add(PlayNote(Tunes.Tone.G4));
            melody.Add(PlayNote(Tunes.Tone.C5));
            melody.Add(PlayNote(Tunes.Tone.G4));
            melody.Add(PlayNote(Tunes.Tone.E4));
            melody.Add(PlayNote(Tunes.Tone.C4));

            //tunes.Play();

            //Thread.Sleep(100);

            melody.Add(PlayNote(Tunes.Tone.E4));
            melody.Add(PlayNote(Tunes.Tone.G4));
            melody.Add(PlayNote(Tunes.Tone.C5));
            melody.Add(PlayNote(Tunes.Tone.G4));
            melody.Add(PlayNote(Tunes.Tone.E4));
            melody.Add(PlayNote(Tunes.Tone.C4));
            var tunes = new Tunes(FEZRaptor.Socket18.PwmPin.Controller2.Id, FEZRaptor.Socket18.PwmPin.Controller2.PC20);

            tunes.Play(melody);
        }
Beispiel #6
0
		public void SoundAlarm()
		{
			var melody = new Tunes.Melody();

			melody.Add((int) C4, Quarter);
			melody.Add((int) F4, Quarter);
			melody.Add((int) C5, Half);

			_tunes.Play(melody);
		}