I’d like to be able to use my USB keyboard (qwerty, not piano) to send MIDI data to Norns, akin to the musical typing function in Logic X - it’d save me taking both keyboard and MIDI keyboard out with me for lightweight sessions. I’ve had a look on lines but can’t find anything.
Any suggestions on where to find or how to build welcomed! Cheers
@eigen 's “gridkeys” mod is a well-written example of how to inject new functionality that transforms some other input into MIDI events:
for this feature, the mod could inject itself into the script-level keyboard handler, which is a global named
keyboard.code, called by the system here;
(for key releases, the “value” argument is zero)
keyboard.code is expected to be redefined by a script. so to inject stuff into it, you would use the same method as demonstrated in
gridkeys and most mods:
- run the mod in post-init hook so it’s run after each script is initialized.
- there, wrap the script’s defined HID handler in a new function:
script_key_handler = keyboard.code mod_key_handler = function(code, value) map_keys_to_midi_and_spawn_events_etc(code, value) end keyboard.code = function(code, value) script_key_handler(code_value) mod_key_handler(code, value) end