-
-
Save Warwolt/c2a0f7745f00e3fd4113d35afcf093e1 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def create_note_to_midi_dict(): | |
""" | |
Create a dict for the the midi implementation table in the Xone K2 manual, | |
used to make it easier to refer to the byte values of the midi notes. | |
The key value pairs are e.g. ('c#1', 25) or ('g4', 67). | |
""" | |
notes = ['c','c#','d','d#','e','f', 'f#', 'g','g#','a','a#','b'] | |
octaves = [str(num) for num in range(-1, 10)] | |
octave_notes = [note + octave for octave in octaves for note in notes] | |
return {octave_notes[i]: i for i in range(len(octave_notes))} | |
def create_element_color_dict(note_to_midi): | |
""" | |
Create a dict for looking up the midi note to send to light up an element | |
in red, yellow or green, corresponding to the table in the Xone K2 manual. | |
note_to_midi: dict created with create_note_to_midi_dict() | |
""" | |
return { | |
'layer_button' : { | |
'red' : note_to_midi["c0"], | |
'yellow' : note_to_midi["e0"], | |
'green' : note_to_midi["g#0"], | |
} | |
} | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment