Created
September 17, 2023 20:21
-
-
Save nucklearproject/823331176a98303fcc35ac794fa4b385 to your computer and use it in GitHub Desktop.
Mido python - Receive messages from muiltiple input port and print them out.
This file contains 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
""" | |
Receive messages from muiltiple input port and print them out. | |
""" | |
import sys | |
#from mido.ports import MultiPort | |
from mido import open_input, get_input_names | |
ports = get_input_names() | |
portA = open_input(ports[1]) | |
portB = open_input(ports[2]) | |
while True: | |
for msg1 in portA.iter_pending(): | |
print(f'Received {msg1}') | |
sys.stdout.flush() | |
for msg in portB.iter_pending(): | |
print(f'Received {msg}') | |
sys.stdout.flush() | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment