diff --git a/src/python/midi.py b/src/python/midi.py index b166b3d4..1f6501c3 100644 --- a/src/python/midi.py +++ b/src/python/midi.py @@ -116,7 +116,7 @@ def create_callback(name): else: status = message[0] - channel = (status & 0xF) + 1 + channel = (status & 0x0F) + 1 osc['args'].append({'type': 'i', 'value': channel}) @@ -161,7 +161,7 @@ for name in inputs: def midi_message(status, channel, data1=None, data2=None): - msg = [(status & 0xF0) | (channel - 1 & 0xF)] + msg = [(status & 0xF0) | (channel - 1 & 0x0F)] if data1 != None: msg.append(data1 & 0x7F) @@ -214,7 +214,7 @@ def send_midi(name, event, *args): mtype = NOTE_OFF elif mtype == PITCH_BEND: - args = args[:1] + [args[1] & 0x7f, (args[1] >> 7) & 0x7f] # convert 0-16384 -> 0-127 pair + args = args[:1] + [args[1] & 0x7F, (args[1] >> 7) & 0x7F] # convert 0-16384 -> 0-127 pair elif mtype == PROGRAM_CHANGE and PROGRAM_CHANGE_OFFSET: args[-1] = args[-1] - 1 diff --git a/src/python/utils.py b/src/python/utils.py index 1ab479fc..56fde861 100644 --- a/src/python/utils.py +++ b/src/python/utils.py @@ -11,9 +11,6 @@ MIDI_TO_OSC = { POLY_PRESSURE: '/key_pressure' } -for i in range(SYSTEM_EXCLUSIVE + 1, 256): - MIDI_TO_OSC[i] = '/sysex' - OSC_TO_MIDI = { '/note': NOTE_ON, '/control': CONTROL_CHANGE, @@ -36,7 +33,7 @@ def midi_str(message): else: status = message[0] - channel = (status & 0xF) + 1 + channel = (status & 0x0F) + 1 try: