The documentation for python-rtmidi
is basically the worse that it is ever written. I'm trying to figure out how to get midi event data using that program. The data I want is something like this
[
I'm not even sure if python-rtmidi
can get that data, that's how bad their documentation is that they do not even tell you what it is that their app does. But in any case I need that data and I need it to be in a python program. The only example that exists on the python-rtmidi
webpage seems to only show how to output a midi-event to an external musical instrument. I want the opposite. I want the data from the instrument to show up on my computer. I can at least get the software to sense my external instrument. For example, when I use the following code
import logging
import sys
import time
from rtmidi.midiutil import open_midiport
from rtmidi.midiutil import open_midiinput
log = logging.getLogger('test_midiin_poll')
log = logging.getLogger('midiin_poll')
logging.basicConfig(level=logging.DEBUG)
# Prompts user for MIDI input port, unless a valid port number or name
# is given as the first argument on the command line.
# API backend defaults to ALSA on Linux.
port = sys.argv[1] if len(sys.argv) > 1 else None
try:
midiin, port_name = open_midiport(port)
midiin, port_name = open_midiinput(port)
except (EOFError, KeyboardInterrupt):
sys.exit()
It can detect my external Alesis keyboard but I see no variable that resembles something like a key being hit on the keyboard. I also need to point out that I need python software which can record the events in real time. My first goal is to get the midi events then write a program that calculates whether or not the events are timed properly.
Update
This guy at least is sort of doing what I want to do. He can get the midi events but he doesn't say how he got them.
Mido - How to get midi data in realtime from different ports