Pygame MIDI function for just key down or key up rather than MIDIIN? -
so i'm using function detect events midi keyboard printed out sheet music:
for e in events: if if e.type in [pygame.midi.midiin]:
this returns 2 events, 1 when key pressed down , 1 when pressed up.this works great individual notes because create function make if statement trigger every other time there event it's difficult chords because events coming in variety of order note 40 keydown, note 41 keydown, note 41 key up, note 40 key up. or note 40 down, note 41 up, note 40 down, note 41 up. etc etc. except doesnt 'key up' or 'key down' triggers if statement. question is there function triggered on key being pressed either down or up? pygame.midi.midi_keydown
the read()
function returns raw bytes of midi message, without parsing them.
the midis2events()
function not these bytes either:
((status,data1,data2,data3),timestamp) = midi e = pygame.event.event(midiin, status=status, data1=data1, data2=data2, data3=data3, timestamp=timestamp, vice_id = device_id)
so have parse messages yourself: status byte between 0x90
, 0x9f
note on, , between 0x80
, 0x8f
, note off.
Comments
Post a Comment