Skip to content

Instantly share code, notes, and snippets.

@Perlence
Last active Mar 17, 2019
Embed
What would you like to do?
FreePIE: Map MIDI notes to keyboard presses
NOTE_TO_KEY = {
36: Key.Q,
38: Key.W,
40: Key.E,
41: Key.R,
}
def update(midi):
data = midi.data
if data.status not in (MidiStatus.NoteOn, MidiStatus.NoteOff):
return
note, velocity = data.buffer
key = NOTE_TO_KEY.get(note)
if key is None:
return
pressed = data.status == MidiStatus.NoteOn
keyboard.setKey(key, pressed)
if starting:
midi[0].update += lambda: update(midi[0])
@666noda

This comment has been minimized.

Copy link

@666noda 666noda commented Mar 17, 2019

After Pressing Midi, code worked once and then nothin.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment