Example #1
0
 protected void NoteOn(Channel channel, Pitch pitch, int velocity)
 {
     if (muted)
     {
         return;
     }
     outputDevice.SendNoteOn(channel, pitch, velocity);
 }
        private void ActivateLeds()
        {
            Console.WriteLine("Activating LEDS...");
            var pitchValues = Enum.GetValues(typeof(Pitch));

            foreach (Pitch pitchValue in pitchValues)
            {
                for (int j = 60; j < 80; j++)
                {
                    _midiOutDevice.SendNoteOn(Channel.Channel1, pitchValue, j);
                }
            }
        }
Example #3
0
        private void PlayChordRun(IOutputDevice outputDevice, Chord chord, int millisecondsBetween)
        {
            var previousNote = (Pitch)(-1);

            for (var pitch = Pitch.A0; pitch < Pitch.C8; ++pitch)
            {
                if (chord.Contains(pitch))
                {
                    if (previousNote != (Pitch)(-1))
                    {
                        outputDevice.SendNoteOff(Channel.Channel1, previousNote, 80);
                    }
                    outputDevice.SendNoteOn(Channel.Channel1, pitch, 80);
                    Thread.Sleep(millisecondsBetween);
                    previousNote = pitch;
                }
            }
            if (previousNote != (Pitch)(-1))
            {
                outputDevice.SendNoteOff(Channel.Channel1, previousNote, 80);
            }
        }