SendNoteOff() public method

Sends a Note Off message to this MIDI output device.
channel, note, or velocity is /// out-of-range. The device is not open. The message cannot be sent.
public SendNoteOff ( Channel channel, Pitch pitch, int velocity ) : void
channel Channel The channel.
pitch Pitch The pitch.
velocity int The velocity 0..127.
return void
Esempio n. 1
0
 public void HandleTimeOuts(TimeSpan elapsed)
 {
     for (int i = timeOuts.Count - 1; i >= 0; i--)
     {
         var timeOut = timeOuts[i];
         if (elapsed >= timeOut.End)
         {
             outputDevice.SendNoteOff(timeOut.Channel, timeOut.Pitch, timeOut.Velocity);
             timeOuts.RemoveAt(i);
         }
     }
 }
Esempio n. 2
0
 void PlayChordRun(OutputDevice outputDevice, Chord chord, int millisecondsBetween)
 {
     Pitch previousNote = (Pitch)(-1);
     for (Pitch 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);
     }
 }
Esempio n. 3
0
 public static void PlayRunUpKeyboard(OutputDevice outputDevice, Predicate<Note> predicate,
     int millisecondsBetween)
 {
     Note previousNote = (Note)(-1);
     for (Note note = Note.A0; note < Note.C8; ++note)
     {
         if (predicate(note))
         {
             if (previousNote != (Note)(-1))
             {
                 outputDevice.SendNoteOff(Channel.Channel1, previousNote, 80);
             }
             outputDevice.SendNoteOn(Channel.Channel1, note, 80);
             Thread.Sleep(millisecondsBetween);
             previousNote = note;
         }
     }
     if (previousNote != (Note)(-1))
     {
         outputDevice.SendNoteOff(Channel.Channel1, previousNote, 80);
     }
 }
Esempio n. 4
0
 public void NoteOff(NoteOffMessage msg, OutputDevice output)
 {
     if (msg.Pitch.Octave() * 12 + msg.Pitch.PositionInOctave() < 41)
         output.SendNoteOff(msg.Channel, msg.Pitch - 12, msg.Velocity);
 }
Esempio n. 5
0
        public static string sendMessage(OutputDevice midiDevice, byte[] data)
        {
            int order = data[0];
            string debug;
            switch (order)
            {
                /*NoteOff Channels 1 to 16*/
                case 128:
                    midiDevice.SendNoteOff(Channel.Channel1, pitchDetermination.notes(data[1]), data[2]);
                    debug = "Sending NoteOff Message At Channel 1";
                    return debug;
                case 129:
                    midiDevice.SendNoteOff(Channel.Channel2, pitchDetermination.notes(data[1]), data[2]);
                    debug = "Sending NoteOff Message At Channel 2";
                    return debug;
                case 130:
                    midiDevice.SendNoteOff(Channel.Channel3, pitchDetermination.notes(data[1]), data[2]);
                    debug = "Sending NoteOff Message At Channel 3"; 
                    return debug;
                case 131:
                    midiDevice.SendNoteOff(Channel.Channel4, pitchDetermination.notes(data[1]), data[2]);
                    debug = "Sending NoteOff Message At Channel 4";
                    return debug;
                case 132:
                    midiDevice.SendNoteOff(Channel.Channel5, pitchDetermination.notes(data[1]), data[2]);
                    debug = "Sending NoteOff Message At Channel 5"; 
                    return debug;
                case 133:
                    midiDevice.SendNoteOff(Channel.Channel6, pitchDetermination.notes(data[1]), data[2]);
                    debug = "Sending NoteOff Message At Channel 6"; 
                    return debug;
                case 134:
                    midiDevice.SendNoteOff(Channel.Channel8, pitchDetermination.notes(data[1]), data[2]);
                    debug = "Sending NoteOff Message At Channel 7"; 
                    return debug;
                case 135:                     
                    midiDevice.SendNoteOff(Channel.Channel8, pitchDetermination.notes(data[1]), data[2]);
                    debug = "Sending NoteOff Message At Channel 8";
                    return debug;
                case 136:                     
                    midiDevice.SendNoteOff(Channel.Channel9, pitchDetermination.notes(data[1]), data[2]);
                    debug = "Sending NoteOff Message At Channel 9";
                    return debug;
                case 137:                     
                    midiDevice.SendNoteOff(Channel.Channel10, pitchDetermination.notes(data[1]), data[2]);
                    debug = "Sending NoteOff Message At Channel 10";
                    return debug;
                case 138:                    
                    midiDevice.SendNoteOff(Channel.Channel11, pitchDetermination.notes(data[1]), data[2]);
                    debug = "Sending NoteOff Message At Channel 11";
                    return debug;
                case 139:                     
                    midiDevice.SendNoteOff(Channel.Channel2, pitchDetermination.notes(data[1]), data[2]);
                    debug = "Sending NoteOff Message At Channel 12";
                    return debug;
                case 140:                     
                    midiDevice.SendNoteOff(Channel.Channel13, pitchDetermination.notes(data[1]), data[2]);
                    debug = "Sending NoteOff Message At Channel 13";
                    return debug;
                case 141:
                    midiDevice.SendNoteOff(Channel.Channel14, pitchDetermination.notes(data[1]), data[2]);
                    debug = "Sending NoteOff Message At Channel 14";
                    return debug;
                case 142:                     
                    midiDevice.SendNoteOff(Channel.Channel15, pitchDetermination.notes(data[1]), data[2]);
                    debug = "Sending NoteOff Message At Channel 15";
                    return debug;
                case 143:                     
                    midiDevice.SendNoteOff(Channel.Channel16, pitchDetermination.notes(data[1]), data[2]);
                    debug = "Sending NoteOff Message At Channel 16";
                    return debug;

                /*Note ON Channels 1 to 16*/                    
                case 144:
                    midiDevice.SendNoteOn(Channel.Channel1, pitchDetermination.notes(data[1]), data[2]);
                    debug = "Sending NoteOn Message At Channel 1";
                    return debug;
                case 145:                     
                    midiDevice.SendNoteOn(Channel.Channel2, pitchDetermination.notes(data[1]), data[2]);
                    debug = "Sending NoteOn Message At Channel 2";
                    return debug;
                case 146:                     
                    midiDevice.SendNoteOn(Channel.Channel3, pitchDetermination.notes(data[1]), data[2]);
                    debug = "Sending NoteOn Message At Channel 3";
                    return debug;
                case 147:                     
                    midiDevice.SendNoteOn(Channel.Channel4, pitchDetermination.notes(data[1]), data[2]);
                    debug = "Sending NoteOn Message At Channel 4";
                    return debug;
                case 148:                     
                    midiDevice.SendNoteOn(Channel.Channel5, pitchDetermination.notes(data[1]), data[2]);
                    debug = "Sending NoteOn Message At Channel 5";
                    return debug;
                case 149:                     
                    midiDevice.SendNoteOn(Channel.Channel6, pitchDetermination.notes(data[1]), data[2]);
                    debug = "Sending NoteOn Message At Channel 6";
                    return debug;
                case 150:                     
                    midiDevice.SendNoteOn(Channel.Channel7, pitchDetermination.notes(data[1]), data[2]);
                    debug = "Sending NoteOn Message At Channel 7";
                    return debug;
                case 151:                     
                    midiDevice.SendNoteOn(Channel.Channel8, pitchDetermination.notes(data[1]), data[2]);
                    debug = "Sending NoteOn Message At Channel 8";
                    return debug;
                case 152:     
                    midiDevice.SendNoteOn(Channel.Channel9, pitchDetermination.notes(data[1]), data[2]);
                    debug = "Sending NoteOn Message At Channel 9";
                    return debug;
                case 153:                     
                    midiDevice.SendNoteOn(Channel.Channel10, pitchDetermination.notes(data[1]), data[2]);
                    debug = "Sending NoteOn Message At Channel 10";
                    return debug;
                case 154:                     
                    midiDevice.SendNoteOn(Channel.Channel11, pitchDetermination.notes(data[1]), data[2]);
                    debug = "Sending NoteOn Message At Channel 11";
                    return debug;
                case 155:                     
                    midiDevice.SendNoteOn(Channel.Channel12, pitchDetermination.notes(data[1]), data[2]);
                    debug = "Sending NoteOn Message At Channel 12";
                    return debug;
                case 156:                     
                    midiDevice.SendNoteOn(Channel.Channel13, pitchDetermination.notes(data[1]), data[2]);
                    debug = "Sending NoteOn Message At Channel 13";
                    return debug;
                case 157:                  
                    midiDevice.SendNoteOn(Channel.Channel14, pitchDetermination.notes(data[1]), data[2]);
                    debug = "Sending NoteOn Message At Channel 14";
                    return debug;
                case 158:                     
                    midiDevice.SendNoteOn(Channel.Channel15, pitchDetermination.notes(data[1]), data[2]);
                    debug = "Sending NoteOn Message At Channel 15";
                    return debug;
                case 159:                     
                    midiDevice.SendNoteOn(Channel.Channel16, pitchDetermination.notes(data[1]), data[2]);
                    debug = "Sending NoteOn Message At Channel 16";
                    return debug;
                case 176:
                    midiDevice.SendControlChange(Channel.Channel1, Control.Volume, data[1]);
                    debug = "Sending ControlChange At Channel 1";
                    return debug;
                default:
                     debug = "NO Valido";
                    return debug;
            }
        }