Linux /dev/input/* to Jack MIDI Program.

Take a Keyboard and add a driver and instant MIDI controller.

midikb to mackie control surface

The software driver is based on actkbd. But I have forked it to make midikdb. midikbd grabs the selected events file (/dev/input/event*) so that xorg doesn't get anything from it. Yes this means I have two keyboards so I can input text as normal too. Midikbd opens Jack MIDI ports which can be connected to a DAW. I have been using Ardour which can be set up with less than 8 channel controller banks if needed.

Midikbd offers:

  1. send three byte MIDI events for a key stroke.
  2. make two keys into a Mackie style encoder. One key ticks up and the other down... Easy.
  3. make two keys into a pitch bend. A variable is incremented and decremented and that value is sent as a pitch bend event. The resulting return message can set the value of this variable too so that banking can work.
  4. make two keys into a MIDI CC. This is the same as the pitch bend, a variable is incremented and decremented by two keys and can be set by a return message. This and the two above can be set to have different amounts of ticks per keystroke and in my case I have set repeat to be 4 ticks.
  5. make two keys into an encoder style MIDI controller.
  6. make modifier keys, either as two keys to send a single MIDI event (example in wiimote.conf) or to send a MIDI modifier key (example in mcp.conf) as the Mackie Control surfaces do.
  7. The three LEDs can be set to three MIDI events. This is not as good as it can be, right now the returned midi event to turn the LED on must come very soon after a key press that triggers it as the loop that writes it to the LED is in the same loop as the keyboard read which is blocking at present... something to work on.
  8. Direct control of jack transport. stop, roll, zero, nudge forward and nudge back. (though I have not found this useful)

The keys are fully configurable in a config file. So the keyboard could be setup to do any kind of MIDI control that just needs switches. A USB numeric keypad (as sold for use with laptops) could make a very handy small controller too. This would have the advantage over keyboard short cuts that the application being controlled does not have to be focused. The actkbd functionality is still there too, so it is possible to run shell commands from a key press as well.

This could be useful for something like the BCF2000 that uses lots of internal shifts to make up for less buttons. This could add other buttons.

It may be possible to use real encoders with the right detents (the centre of the detent has both switches off) in place of the two keys. However, a better controller is only $35 that could use any encoder and as encoders and switches are added, their cost would make the better controller a better deal.

Things I could do? Use non-blocking control for the event file would allow better LED control including flashing. split the keyboard so that everything except the numeric keypad still goes to the OS and the numeric pad is MIDI. Do NRPN/RPN. But so far I don't have a need for these things.

The code:

The code (such as it is) can be downloaded from here: midikb on Github.

Or cloned from: for the very latest maybe unreleased version.

The code is very raw, there is no configure script, but what is needed is easy to figure out. Most systems That have done any jack application building will just work. For others set up the system for basic building and then make sure the include files for libjack are there. (in ubuntu this is libjack-jackd2-dev)