public int SendMidi(byte[] midi) { int result = -1; int msg = BitConverter.ToInt32(midi, 0); // convert byte[] to int result = WinMM.midiOutShortMsg(outHandle, msg); // sending message if (result != 0) { throw new Exception("Cannot send short message"); } AfterShortSent?.Invoke(midi); // if not null Invoke return(result); }