Browse the docs

Send MIDI

Sends a MIDI note, controller change or raw message to your MIDI devices.

Send MIDI kind

Keyboard Maestro: SendMIDIMessage

Details #

Sends one MIDI message to a destination through CoreMIDI. kind chooses the message:

  • noteOn and noteOff use channel, note and velocity.

  • controlChange uses channel, controller and value.

  • packet sends the bytes in packet as they are, for example 90 3C 40. Spaces and commas are ignored; each byte is two hex digits.

Channels count from 1 to 16 as musicians count them. Notes, velocity, controller and value are 0 to 127. Defaults: channel 1, velocity 64, everything else 0. The numbers can come from variables.

port picks the destination by its name or unique ID. Without it the message goes to every MIDI destination.

The output is the bytes sent as hex, such as 90 3C 40. The Trace note says how many destinations got it.

Parameters #

ParameterTypeRequiredValuesWhat it does
kindone ofYesnoteOn noteOff controlChange packetRequired. noteOn, noteOff, controlChange or packet.
channelany value1 to 16. Default 1.
controllerany valueThe controller number, 0 to 127.
noteany valueThe note number, 0 to 127. Middle C is 60.
packettextHex bytes for kind: packet.
porttextA destination name or unique ID. Optional.
valueany valueThe controller value, 0 to 127.
velocityany value0 to 127. Default 64.

Every step also accepts label, onFailure, timeout and dryRunSafe.

Examples #

Play middle C on every MIDI destination (dry run only simulates it)
Do
  1. Send MIDI note on
  2. Show “Note sent”
Open in Switchboard to try it

Gotchas #

  • A value out of range fails, for example MIDI note must be 0 to 127, not 200 or MIDI channel must be 1 to 16, not 0.

  • A packet that is empty, has an odd number of digits or contains non-hex characters fails with the MIDI packet must be hexadecimal bytes, like 90 3C 40.

  • A note on does not stop by itself. Send a noteOff for the same note when you want it to end.

  • Fails with no MIDI destination is available, or no MIDI destination called "<port>" when port matches nothing. port matches a destination's display name (any case) or its unique ID exactly.

  • In a dry run the step is simulated and nothing is sent.

See also #

MIDI message, Switch audio device