Adding keystroke functionality to a Midi keyboard using Max and the aka.keyboard object
By Jaems • Apr 23rd, 2009 • Category: TutorialsI’ve discussed the great aka objects in another post that dealt with using the Sudden Motion Sensor of the Macbook to control a game of Pacman [link]. This post will deal with the aka.keyboard object and how to use it to add keystroke functionality to a Midi keyboard. This would be useful in situations where you would want to use a Midi keyboard for note input, and the number pad on the computer keyboard for values, for example. In such a case, you might want to anchor one hand on the Midi keyboard, and another hand on the number pad. In order to access other common keystrokes like “undo” or the left and right arrows, you would need to move your hand and lose your position, which can mean more mistakes. But using a fairly simple Max patch, you can add the keystroke functionality you want directly to the Midi keyboard so your favorite key combinations are right at your fingertips. Here’s what you need:
Max
aka.keyboard
A Midi keyboard with buttons sending CC values
I recently bought the Korg nanoKey, and I am a Finale user so I will use these two as an example. The Korg nanoKey is special because it’s so tiny. It has two octaves of notes and 6 buttons. two of the buttons are for octave changing and one is for switching all the keys to Continuous Controller (CC) output. These buttons can’t be used for this patch. The lower three buttons are the ones that we’re interested in. The two to the left are for pitch bend up and down, and the one to the right is a Mod button. These are the buttons we will be using (see below). On most keyboards, Pitch Bend and Mod will be controlled using wheels instead of buttons, but I’ll use the term “buttons” to mean either buttons or wheels. I would think that this would work best with the nanoKey’s setup, and not so well with normal wheels, although it might work fine.
Process (download completed patch here)
1) Capture the buttons. You can do this by creating a new Max patch and using the bendin and ctlin objects. Bendin is easy because it only captures pitch bend info. The bend down button goes to “0″ and the bendup button goes to “127″. For some reason, Max outputs 0 and 127 twice, so for the test patch at the end of this post, I’ve selected 3 and 121. Capturing the Mod button is trickier because it comes in through the ordinary Continuous Controllers. Mod wheel uses controller 1.
2) Turn them into keystrokes. Using aka.keyboard, you can choose which keystrokes you want to use. The help patch for aka.keyboard is thorough, and you can use it to choose the keystrokes you want. I have chosen to use left arrow (key 123), right arrow (key 124), and Undo: Apple-Z (keydown 55, key 6, keyup 55). Undo (Apple-Z) is really practical, especially when you’re working with Finale. Sometimes with the nanoKey, notes aren’t picked up during speedy entry, so Undo allows you to correct them easily.
That’s it, you’re done! Now you can fire up your patch whenever you are using your Midi keyboard.



Leave a Comment