Feature Request: Implement MIDI sending to devices

I finally had some time to dig into the issues, and I think I now understand the source of the confusion and frustration that a number of us have had with the MIDI send actions. The short answer is, I don't believe KM actually implements MIDI send actions as such, it implements what might be called MIDI reception actions. Fortunately I don't think this would be very difficult to fix.

First, some background: What are we trying to achieve? The common thread I see among threads with users having MIDI issues is that we want to send messages to some MIDI device in order to control it. A typical example would be @Demetrius147's use case, with the Novation Launchpad products:

This is a device with a grid of buttons. It will send MIDI messages on button presses. KMs MIDI triggers would work very well with this to trigger macros, turning it into a powerful input device for KM, sort of a giant StreamDeck, or an XKeys alternative with controllable RGB buttons.

The device can also act on MIDI messages it receives, for example to update the LEDs to give the user feedback. Unfortunately, KM isn't able to support this directly today.

I think what KM's MIDI send actions are doing is creating a virtual MIDI channel and calling MIDIReceived() on it, to simulate reception of these messages. It doesn't have a way to call MIDISend() to actually send messages, which is what we're wanting and expecting.

The former really only allows other software on the Mac to process these messages, something like Garageband or Logic Pro. I suppose it is useful in some cases to control other software by MIDI, but KM already has a lot of ways to control other software.

The only way to use these actions to control MIDI hardware is to involve some other piece of software to listen to KM and then actually call MIDISend() to get it sent to the right place. I've spent hours fiddling with Audio MIDI Setup, and I don't think it's capable of doing this. Some piece of third party software is required. This is needlessly complex and confusing to people who aren't MIDI experts.

It's at this point I'd suggest looking at MidiKeys for solutions. MidiKeys is a small application that simulates a on-screen MIDI keyboard:

MidiKeys offers two different ways to "send" the pressed notes, based on the selection of the "Destination" dropdown. In "Virtual Source" mode it does what KM's MIDI Send actions do: It presents a virtual MIDI source and calls MIDIReceived() with the notes to allow other software to listen to them. Or, the user can select a MIDI device from the dropdown, and then it will call MIDISend() to send directly to this device:

This is what I'd like to see in KM: Add a similar dropdown added to the MIDI Send actions that allows picking a device, or acting in the current virtual source mode. The code for MidiKeys is available, and the extra logic to support MIDISend() vs MIDIReceived() does not look very complicated.

For testing, a CircuitPython board is an easy and inexpensive way to get a USB MIDI device. The Adafruit Neo TrinKey is one option (only $7 US), or their MacroPad is a fancy but still fairly inexpensive option. The screen on the MacroPad would be great for debugging, if configured to display whatever messages are received. Heck, I'd even be willing to chip in to get you a MacroPad and provide some sample code to test against if it can help get this feature added.

In the meantime, I'll note that MidiKeys can also be used as a workaround. By selecting "Keyboard Maestro" as the source and a MIDI device as the destination, and checking the "Thru" box, it can be configured to relay messages from KM to the device:

But, this only works for one device at a time, and requires extra software and configuration that should really not be needed. It would be best if MIDI sending could be built into KM. I think this could make KM quite popular with MacroPad users in particular.

Cheers,
TC

Yes please.

And thanks for this information; I couldn't work out what was going on.
Perhaps MidiPipe might also help
http://www.subtlesoft.square7.net/MidiPipe.html

+1 to this. I'm trying to figure out a way to simply illuminate the light of specific buttons on my Arturia Beatstep via Keyboard Maestro (i.e. so I can illuminate a button when it triggers a specific Keyboard Maestro macro. That Midikeys app shows that it's possible to do so, but I can't figure out how to accomplish this via Keyboard Maestro.

This is an old request but KM could do with an update to its Midi messaging functions eg ability to select device or driver bus to be used, some basic filtering, monitoring, message conversion in a simple visual form (eg midi pipeline’s approach), simplifying requirement to enter raw messages in hex.

Think of KM as a device. It can listen to any MIDI that is being transmitted from another device that is connected, and it can send out MIDI for other devices to pick up. You might find parts of this discussion (once it really gets going!) to be worthwhile: Questions regarding MIDI

Since KM is an automation system and not a dedicated MIDI processing application like MidiPipe, we have to be wary of comparing apples and oranges. While a solution would, with the investment of enough time and effort, be possible in KM, we come back to the underlying consideration of whether implementation of requirements (particularly more specialist ones) are better handled in macros rather than as part of KM’s built-in functionality. Opinions will differ on where the dividing line falls, but there is just one person here who can and will decide! :wink:

+1 for selecting output ports of other devices

I do not understand what is meant here. Could you please give an example?

As @kevinb notes, Keyboard Maestro Engine is a device for sending MIDI packets to the system, and for receiving MIDI packets from the system.

It is not a MIDI router, so it does not control where the packets come from or go to. That is handled by other software.

It's unlikely this will change.

This might be helpful: