python listen for midi code example
Example: mido python
>>> import mido
>>> msg = mido.Message('note_on', note=60)
>>> msg.type
'note_on'
>>> msg.note
60
>>> msg.bytes()
[144, 60, 64]
>>> msg.copy(channel=2)
<message note_on channel=2 note=60 velocity=64 time=0>