Questions regarding MIDI

Since MIDI is, essentially, a broadcast signal the limitation seems to be that the KM action's output port is fixed -- all listeners see every signal as coming from "Keyboard Maestro". (Am I even close, @kevinb?)

But you might be able to use SendMIDI with named virtual ports and have "myDawPort" respond to messages from "virtualPort1", "myAudioInterfacePort" respond to "virtualPort2", etc. And since SendMIDI is a command line tool you can run it via a KM "Execute a Shell Script" action, in macros triggered by your preferred hot keys.

But when it comes to MIDI I'm even more inconsistent in my responses than ChatGPT :wink: , so do your own experiments.

Fair enough and thanks for the update.

In a previous reply, I compared the send MIDI action to a hardware MIDI keyboard plugged into the computer. Both the keyboard and the KM action can output on a specified channel (1–16) and then any software that has been set to listen to that channel will react to the message. So the send MIDI action is not limited in terms of traditional MIDI 1.0. Beyond that… I would need to allocate more time than I can at the moment to collecting my thoughts about the theory and reading up on the bits that I am unsure about (e.g. what MIDI 2.0 brings to the table)—and of course any findings would not relate directly to Keyboard Maestro anyhow.

Welcome aboard. You will find it very useful and mentally stimulating! :smile:

It’s not a program that I would reach for when handling MIDI other than for, say, repurposing a spare piece of MIDI controller hardware to control just about any piece of software, but that use would be in keeping with the sort of purpose that KM is designed for. I think trying to stretch KM far beyond that (e.g. for versatile processing of modulation wheel messages) would be quite possible but it probably wouldn’t be the ideal tool for the job. Something like Pure Data (PD) or Max would be more suitable if you really want to get into advanced MIDI programming.

1 Like

I was going to use the word “broadcast” too, but I was wary because I could not find any articles that used that word in connection with MIDI (it’s predictable but still funny how the LLMs go quiet or change the subject in such situations :wink:). But yes, I think it’s an appropriate term or at least analogy.

Yes, that’s how MIDI works. When a key is pressed on a MIDI keyboard controller, the keyboard sends the data over the specified channel and that’s it. It’s job has been done. Maybe the message will be heard by a computer and a piano module or maybe nothing else is plugged in, but none of that is of concern to the keyboard, which has done its job.

Most MIDI hardware these days will carry MIDI over USB connections, but the protocol is the same as when carried over those old DIN connections that you might still see on the back of some MIDI keyboards. One is for MIDI in and one is for MIDI out[1] and that reminds us that MIDI 1.0 is a unidirectional protocol. If we want to hear back from the computer or sound module, we need a separate line for that.

Checks... Yes, as I seemed to remember, MIDI 2.0 offers bidirectional communication but that’s a whole new can of worms. As the MIDI Association says: “MIDI 2.0 may seem really complicated. Yes, it actually is more complicated…”


  1. Yes, you may also see “MIDI thru” but that is just repeating the incoming MIDI. ↩︎

3 Likes