Playing MIDI files into the Duo with Python


I have a set of MIDI drum loop files that I’ve been wanting to make more use of, especially for jamming and live looping. After failing in a search to find a simple piece of software that would take MIDI files as input and output messages to a port in realtime, I found a nice Python library called Mido that easily lets me do what I want.

I have a Roland USB MIDI interface. Once the device was installed and ready I connected to the Duo and then ran the following:

import mido
out = mido.open_output('UM_ONE')
loop = mido.MidiFile('/path/to/sizzling/drum_loop.mid')
for msg in = 9  # Channel is 1 by default, set to MIDI percussion channel 10

WIth a Pedalboard connecting the serial MIDI in to a plugin like the FluidGM drums I have some nice sounding percussion loops.