patrickkidd / pyrtmidi

Realtime MIDI I/O for python.
158 stars 14 forks source link

First readme example out of date #18

Open jaywalkerpaz opened 4 years ago

jaywalkerpaz commented 4 years ago

I couldn't get the first example to work, but I modified it and it achieves the objective:

import rtmidi

midiin = rtmidi.MidiIn()
midiin.ignore_types(sysex=False, timing=True, active_sense=True)

ports = range(midiin.get_port_count())
if ports:
    for i in ports:
        print(midiin.get_port_name(i))
    print("Opening port 1!") 
    midiin.open_port(1)
    while True:
        m = midiin.get_message()
        if m:
            print(m)

else:
    print('NO MIDI INPUT PORTS!')
bergamote commented 3 years ago

a bit late but I think that what's happening is that both pyrtmidi and python-rtmidi use the same module name rtmidi. Per the syntax you use in your modified example, what you have installed is python-rtmidi, not pyrtmidi