Created
April 10, 2014 15:43
-
-
Save vi/10395508 to your computer and use it in GitHub Desktop.
Dump MIDI events using python-midi
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # supply two command line arguments | |
| import midi.sequencer.sequencer_alsa as S | |
| import midi.sequencer | |
| import sys | |
| import select | |
| sr = midi.sequencer.SequencerRead() | |
| sr.subscribe_port(sys.argv[1],sys.argv[2]) | |
| p = select.poll() | |
| sr.configure_poll(p) | |
| while True: | |
| #S.client_poll_descriptors(sr.client) | |
| p.poll() | |
| e = S.event_input(sr.client) | |
| if not e: | |
| sys.stdout.write(".") | |
| continue | |
| print "flgs={} tag={} tick={} time={} type={} note={} dur={} offvel={} vel={} chan={} pos={} skewbase={} skewval={} queue={} qpartime={}".format( | |
| e.flags, e.tag, e.time.tick, e.time.time.tv_sec + 1e-9 * e.time.time.tv_nsec, | |
| e.type, e.data.note.note, e.data.note.duration, e.data.note.off_velocity, e.data.note.velocity, | |
| e.data.note.channel, e.data.queue.param.position, e.data.queue.param.skew.base, e.data.queue.param.skew.value, | |
| e.data.queue.queue, e.data.queue.param.time.time.tv_sec + 1e-9 * e.data.queue.param.time.time.tv_nsec ) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
What are those 2 arguments? Can you provide an example?