Turning cheap USB numeric keyboard into 4x4 drum pad controller for Ableton
Posted: 12 Nov 2017, 22:52
Hello!
I've been experimenting with Ableton and decided to control the built-in "A-L Computer MIDI Keyboard" through an extra numeric keyboard connect via USB, but it's not possible to reassign the A-L to 1-9 (for instance) keys on Ableton!
Then LuaMacros came to rescue!
TL;DR: Here is the code:
https://gist.github.com/mustache1up/e2c ... 7ccb342240
Drawback: The signal sent via 'lmc_send_keys()' is a short press-release, so it's only possible to use the pad with drums (once you pressed the key, the sample is played entirely, even if the key is pressed by a fraction of second).
Other problems that I've faced and worked them around:
1. My numeric keyboard has a '000' key. When it's pressed, the keyboard send three times the same code.
Luckily, in this specific keyboard, the code for '000' isn't the same code for the '0' key, then it was possible to do some tricks! (see the code for details)
2. The NUMLOCK key. When pressed, it does send an specific code but it also toggles the Number Lock state.
LuaMacros doesn't intercept this toggling, but I've managed to sent another NUMLOCK signal to reverse to it's previous state!
This is the keyboard I've used (exbom):
That's it!
Hope it help anyone trying to do something similar.
Bye!
M.
P.S.: Now I'm gonna try to make lua send MIDI notes instead, this way it will be possible to use it with other programs AND will surpass the drawback I've mentioned. Any ideas are welcome!
I've been experimenting with Ableton and decided to control the built-in "A-L Computer MIDI Keyboard" through an extra numeric keyboard connect via USB, but it's not possible to reassign the A-L to 1-9 (for instance) keys on Ableton!
Then LuaMacros came to rescue!
TL;DR: Here is the code:
https://gist.github.com/mustache1up/e2c ... 7ccb342240
Drawback: The signal sent via 'lmc_send_keys()' is a short press-release, so it's only possible to use the pad with drums (once you pressed the key, the sample is played entirely, even if the key is pressed by a fraction of second).
Other problems that I've faced and worked them around:
1. My numeric keyboard has a '000' key. When it's pressed, the keyboard send three times the same code.
Luckily, in this specific keyboard, the code for '000' isn't the same code for the '0' key, then it was possible to do some tricks! (see the code for details)
2. The NUMLOCK key. When pressed, it does send an specific code but it also toggles the Number Lock state.
LuaMacros doesn't intercept this toggling, but I've managed to sent another NUMLOCK signal to reverse to it's previous state!
This is the keyboard I've used (exbom):
That's it!
Hope it help anyone trying to do something similar.
Bye!
M.
P.S.: Now I'm gonna try to make lua send MIDI notes instead, this way it will be possible to use it with other programs AND will surpass the drawback I've mentioned. Any ideas are welcome!