micdah / RtMidi.Core

RtMidi for .Net Standard
https://rtmidicore.micdah.dk/
Other
36 stars 12 forks source link

How to send Midi Note On/Off signals to PC. #27

Closed ca3games closed 1 year ago

ca3games commented 2 years ago

Hi, cant find info on how to send notes on/off messages to other applications.

micdah commented 1 year ago

Hi, sorry for my extremely late answer, I assume you have gone onto other things - but just for posterior this is how you could go about sending a MIDI message to a output device:

            var outputDevice = MidiDeviceManager.Default.OutputDevices.First().CreateDevice();
            outputDevice.Send(new NoteOnMessage(Channel.Channel1, Key.Key0, 0));

I'm simply taking the first available MIDI output device (for demonstration purpose) and sending a "Note On" message.

There are C# typed messages for the different MIDI message types, so you don't have to know the byte codes and structure of each 😄