Mido - MIDI Objects for Python

Version 1.1.24

Mido is a library for working with MIDI messages and ports. It’s designed to be as straight forward and Pythonic as possible.

>>> import mido
>>> output = mido.open_output()
>>> output.send(mido.Message('note_on', note=60, velocity=64))
>>> with mido.open_input('SH-201') as inport:
...     for msg in inport:
...         print(msg)
>>> from mido import Message
>>> msg = Message('program_change', program=1)
>>> msg
<message program_change channel=0 program=1 time=0>
>>> msg.copy(program=2, time=100)
<message program_change channel=0 program=2 time=100>
>>> msg.time
100
>>> msg.bytes()
[192, 1]
>>> from mido import MidiFile
>>> for msg in MidiFile('song.mid').play():
...     output.send(msg)

Mido is short for MIDi Objects.

About This Document

This document is available at https://mido.readthedocs.io/

To build locally:

python setup.py docs

This requires Sphinx. The resulting files can be found in docs/_build/.

Contents

Indices and tables