MIDI message
Runs the macro when a MIDI device sends a matching note, controller or other channel message.
A MIDI message arrives on port
Keyboard Maestro: MIDI
Details #
Listens to every MIDI source the Mac knows (keyboards, pads, interfaces, virtual ports) and fires when a message matches message.
message is written as hex bytes: 90 3C is "note on, channel 1, note 60". The status byte comes first, then the data bytes. Spaces, commas and colons all work, and so does a 0x before a byte. The match is by prefix: only the bytes you give must agree, so 90 matches every note on for channel 1, 90 3C matches that one note at any velocity, and 90 3C 7F matches only full velocity.
A few status bytes to know. The low digit is the channel minus one, so 90 is channel 1 and 9F is channel 16.
| Status | Message |
|---|---|
8n | Note off |
9n | Note on |
An | Key pressure |
Bn | Controller (knob, fader, pedal) |
Cn | Program change |
En | Pitch bend |
Only these channel messages are delivered. System messages, clock and sysex are not.
port narrows it to one source. It matches if the source's name contains the text (any case). Left out, all sources match.
Many controllers send a note on with velocity 0 for a release. That arrives as a note on too, so 90 3C fires on release as well. To react to full-velocity presses only, match 90 3C 7F.
{{triggerValue}} is empty for this trigger.
Parameters #
| Parameter | Type | Required | Values | What it does |
|---|---|---|---|---|
message | text | Yes | Required. Hex bytes to match from the start of the message, such as 90 3C. | |
port | text | Text that must appear in the source's name. Optional. |
Every trigger also takes Limits: a cooldown, the first time each day, every nth time, twice within seconds, a chance, only while you are at the Mac, on one Mac, or in a State. See Limits on any trigger.
Examples #
- The MIDI message 90 3C arrives
- Show “Middle C”
Gotchas #
An empty or unreadable
messagenever matches.Each message is split into three bytes. Messages with only one data byte (program change) arrive with a zero third byte, so match them with just the first bytes.
The source starts listening only when at least one enabled macro has a MIDI trigger. If CoreMIDI refuses to start, the trigger source reports
CoreMIDI refused.A device plugged in after Switchboard started is picked up on its own.