Skip to content

Commit 53633ab

Browse files
committed
handle other midi message types - and note_off with vel
1 parent 861f4a9 commit 53633ab

File tree

1 file changed

+12
-1
lines changed

1 file changed

+12
-1
lines changed

birdfish/input/midi.py

+12-1
Original file line numberDiff line numberDiff line change
@@ -103,6 +103,14 @@ def __init__(self, device, *args, **kwargs):
103103
def dispatch(self, message):
104104
"""take a midi message and dispatch it to object who are interested"""
105105
print message
106+
if message.type == 'pitchwheel':
107+
# pitchwheel(channel=0, value=5224)
108+
# print dir(message)
109+
# print message.__dict__
110+
return
111+
if message.type == 'sysex':
112+
# skip
113+
return
106114
if message.type == 'control_change':
107115
message_key = (message.channel, message.control)
108116
else:
@@ -111,7 +119,10 @@ def dispatch(self, message):
111119
for destination in self.observers[message_key]:
112120
if destination['type'] == 'trigger':
113121
# trigger type
114-
vel = message.velocity / 127.0
122+
if message.type == "note_off":
123+
vel = 0
124+
else:
125+
vel = message.velocity / 127.0
115126
destination['receiver'].trigger(vel, key=message_key)
116127
elif destination['type'] == 'map':
117128
in_value = message.value

0 commit comments

Comments
 (0)