Keyboard Maestro can send MIDI messages, which effectively come from a device named “Keyboard Maestro”. The device will be created as soon as you add any MIDI action.
You can send different kinds of MIDI packets
The fields for the note, velocity or controller care calculations, so you can use whatever Variables or Functions are helpful.
The raw MIDI packet must be a valid MIDI packet, and you can use text tokens to create some of the packet to allow arbitrary data to be sent. The Hex2 token may be helpful for formatting the data.