Godtone
Joined 17 December 2020
| Line 1,163: | Line 1,163: | ||
colmaps = { 12: rb12, 13: rb13, 16: cm16, 17: rb17, 18: rb18, 19: rb19, 29: rb29, 30: rb30, 31: rb31 } | colmaps = { 12: rb12, 13: rb13, 16: cm16, 17: rb17, 18: rb18, 19: rb19, 29: rb29, 30: rb30, 31: rb31 } | ||
# TODO: add more colmaps | # TODO: add more colmaps | ||
mo = mido.open_output() # use the same output for entire session | import platform # to check whether we're running Windows, in which case we want to use loopMIDI | ||
mo = mido.open_output() if platform.system()!='Windows' else mido.open_output([ port for port in mido.get_output_names() if 'loop' in port ][0]) | |||
# mo = mido.open_output() # use the same output for entire session | |||
def iso(x=5, y=1, colmap_in=[34], **args): | def iso(x=5, y=1, colmap_in=[34], **args): | ||
global mo | global mo | ||
| Line 1,188: | Line 1,190: | ||
or False ) # whether to interpret the half-buttons as being two buttons for the same note or a single button | or False ) # whether to interpret the half-buttons as being two buttons for the same note or a single button | ||
# find launchpad | # find launchpad output (what we send colour (col) data to) | ||
midi_inputs = mido. | midi_outputs = mido.get_output_names() | ||
print('midi outputs detected:') | |||
for i in midi_outputs: | |||
print(i) | |||
print('selecting:') | |||
launchpad_col = [i for i in midi_outputs if 'Launchpad' in i or 'LP' in i][0] | |||
print(launchpad_col) | |||
# find launchpad input (what we get midi input (mi) data from) | |||
midi_inputs = mido.get_input_names() | |||
print('midi inputs detected:') | print('midi inputs detected:') | ||
for | for i in midi_inputs: | ||
print( | print(i) | ||
print('selecting:') | print('selecting:') | ||
launchpad_mi = [i for i in midi_inputs if 'Launchpad' in i or 'LP' in i][0] | |||
print( | print(launchpad_mi) | ||
# define mapping from midi note given by launchpad to midi note in isomorphic layout | # define mapping from midi note given by launchpad to midi note in isomorphic layout | ||
| Line 1,209: | Line 1,219: | ||
note_state[transform(k)] = 0 | note_state[transform(k)] = 0 | ||
with mido.open_input( | with mido.open_input(launchpad_mi) as mi, mido.open_output(launchpad_col) as col: | ||
print('colouring...') | print('colouring...') | ||
for k in key_codes: | for k in key_codes: | ||