Tuesday, 13 May 2014

Using a USB MIDI device as an OSX keyboard

If you have done any amount of programming or system administration, you must surely have come across the frustration of having to press a keyboard chord to produce important glyphs like {, } or ~. To battle RSI, i present how to use a cheap external MIDI controller like the AKAI LPD8 or the Korg Nanopad 2 as a keyboard for those all important programmer keys on a Mac running OS X.
In addition to a USB MIDI controller, you’re going to need the following, rather ancient software and resources:
Plug in your controller. From MIDI monitor, select the appropriate Source and start tapping your controller’s buttons. Choose some appropriate buttons for the glyphs you want to map to.
Using the MIDI note number table, look up the corresponding number. On my AKAI LPD 8, the first button is C1, and its number is 36.

Now here comes the tricky part. In midiStroke, press the plus icon on the left to add a button. Double click the default value (probably 45) and change it into the correct one. Now click the plus icon on the right. If you want a bracket, you’ll need to enter the “unshifted” key and select the relevant modificator keys. Since i’m using a Finnish keyboard layout, i use keystroke 8 with Shift and Alt modificator keys. Your milage may vary.
You can use “special keys” like Enter and Esc by using their names. Press the keystrokes button to plop up the help pane and simply add the name of the key (like ENTER) in the Keystroke field.