public void PlayNote(MyMidi.Channel channel, MyMidi.Pitch pitch, int velocity, TimeSpan end) { NoteOn(channel, pitch, velocity); var timeOut = new NoteTimeOut() { Channel = channel, End = end - TimeSpan.FromMilliseconds(10), // subtract 10 ms to prevent errors with turning off notes Pitch = pitch, Velocity = velocity }; timeOuts.Add(timeOut); }
/// <summary> /// Note On /// </summary> /// <param name="channel"></param> /// <param name="pitch"></param> /// <param name="velocity"></param> protected void NoteOn(MyMidi.Channel channel, MyMidi.Pitch pitch, int velocity) { if (muted) { return; } try { //outputDevice.SendNoteOn(channel, pitch, velocity); outDevice.Send(new Sanford.Multimedia.Midi.ChannelMessage(ChannelCommand.NoteOn, 0, (int)pitch, velocity)); } catch (Exception ex) { Console.WriteLine(ex.Message); } }