This shows you the differences between two versions of the page.
Both sides previous revision Previous revision Next revision | Previous revision | ||
trigger:MIDI [2017/11/06 01:31] peternlewis |
trigger:MIDI [2025/02/28 21:53] (current) peternlewis [Packet] |
||
---|---|---|---|
Line 3: | Line 3: | ||
You can trigger on specific notes, specific controller changes (v8+), or on any raw MIDI packet (v8+). | You can trigger on specific notes, specific controller changes (v8+), or on any raw MIDI packet (v8+). | ||
- | If the *Allow Recording* checkbox is on, and the note field has the text focus, and you press a MIDI note, then Keyboard Maestro will set the fields to the correct value for you; similarly for the controller field or the raw packet fields. | + | If the *Allow Recording* (*MIDI Learn*) checkbox is on, and the note field has the text focus, and you press a MIDI note, then Keyboard Maestro will set the fields to the correct value for you; similarly for the controller field or the raw packet fields. |
====== Notes ======= | ====== Notes ======= | ||
Line 11: | Line 11: | ||
You can configure the trigger to execute the macro when the note is received from a particular device, from a particular channel or from any device or channel. | You can configure the trigger to execute the macro when the note is received from a particular device, from a particular channel or from any device or channel. | ||
- | The [[token:TriggerValue|%TriggerValue%]] token will hold `channel,note,velocity,device` for press and release (just the velocity was included prior to version 8.0). You can easily access the individual parts using the token array notation, eg `%TriggerValue[2]%` will be the controller (8.0.4+). | + | The [[token:TriggerValue|%TriggerValue%]] token will hold `channel,note,velocity,device` for press and release (8.0.4+) (just the velocity was included prior to version 8.0). You can easily access the individual parts using the token array notation: |
+ | |||
+ | ^ Token ^ Value ^ | ||
+ | | %TriggerValue[1]% | Channel | | ||
+ | | %TriggerValue[2]% | Note | | ||
+ | | %TriggerValue[3]% | Velocity | | ||
+ | | %TriggerValue[4]% | Device | | ||
====== Controller Change ======= | ====== Controller Change ======= | ||
Line 36: | Line 43: | ||
You can configure the trigger to execute the macro when the controller change is received from a particular device, from a particular channel or from any device or channel. | You can configure the trigger to execute the macro when the controller change is received from a particular device, from a particular channel or from any device or channel. | ||
- | The [[token:TriggerValue|%TriggerValue%]] token will hold `channel,controller,value,device`. You can easily access the individual parts using the token array notation, eg `%TriggerValue[2]%` will be the controller (8.0.4+). | + | The [[token:TriggerValue|%TriggerValue%]] token will hold `channel,controller,value,device` (8.0.4+). You can easily access the individual parts using the token array notation: |
- | ====== Raw Packet ======= | + | ^ Token ^ Value ^ |
+ | | %TriggerValue[1]% | Channel | | ||
+ | | %TriggerValue[2]% | Controller | | ||
+ | | %TriggerValue[3]% | Value | | ||
+ | | %TriggerValue[4]% | Device | | ||
+ | |||
+ | |||
+ | ====== Packet ======= | ||
This is a rather advanced trigger that requires some knowledge of the MIDI protocol (v8+). You can configure the minimum and maximum size of the packet, as well as the range of the first two bytes, and a regex that matches the specified packet (the format will be a sequence of space-separated hex values). | This is a rather advanced trigger that requires some knowledge of the MIDI protocol (v8+). You can configure the minimum and maximum size of the packet, as well as the range of the first two bytes, and a regex that matches the specified packet (the format will be a sequence of space-separated hex values). | ||
Line 44: | Line 58: | ||
This should allow you to capture things like SysEx and HUI protocol packets and the like. | This should allow you to capture things like SysEx and HUI protocol packets and the like. | ||
- | The [[token:TriggerValue|%TriggerValue%]] token will the space-separated hex values representing the packet. You can easily access the individual parts using the token array notation, eg `%TriggerValue[3] %` will be the third value (8.0.4+) — note the `[space]` in `][space]%`, the space is the separator for the array, instead of the default comma. | + | The [[token:TriggerValue|%TriggerValue%]] token will the space-separated hex values representing the packet, followed by a comma, followed by the source device. You can get the two parts with. |
+ | |||
+ | ^ Token ^ Value ^ | ||
+ | | %TriggerValue[1]% | Data | | ||
+ | | %TriggerValue[2]% | Device | | ||
+ | |||
+ | If you extract just the bytes (ie, everything up until the first comma), then you can then easily access the individual parts using the token array notation, eg `%DataVar[3] %` will be the third value (8.0.4+) — note the `{space}` in `]{space}%`, the space is the separator for the array, instead of the default comma. |