Mido - MIDI Objects for Python
Overview
Mido is a Python library for working with MIDI 1.0 ports, messages and files:
>>> import mido
>>> msg = mido.Message('note_on', note=60)
>>> msg.type
'note_on'
>>> msg.note
60
>>> msg.bytes()
[144, 60, 64]
>>> msg.copy(channel=2)
Message('note_on', channel=2, note=60, velocity=64, time=0)
port = mido.open_output('Port Name')
port.send(msg)
with mido.open_input() as inport:
for msg in inport:
print(msg)
mid = mido.MidiFile('song.mid')
for msg in mid.play():
port.send(msg)
Mido is short for MIDI objects.
About this document
This document refers to Mido version 1.3.
Note
An up-to-date version of this document is always available at https://mido.readthedocs.io.
License
This documentation (Except our code of conduct) is licensed under the Creative Commons Attribution 4.0 International License.
See also
Community & Source Code
Come visit us at https://github.com/mido.
Everybody is welcome!
See also
Basics
Details
Reference
Community
Appendix
- About MIDI
- Message Types
- Meta Message Types
- Supported Messages
- sequence_number (0x00)
- text (0x01)
- copyright (0x02)
- track_name (0x03)
- instrument_name (0x04)
- lyrics (0x05)
- marker (0x06)
- cue_marker (0x07)
- device_name (0x09)
- channel_prefix (0x20)
- midi_port (0x21)
- end_of_track (0x2f)
- set_tempo (0x51)
- smpte_offset (0x54)
- time_signature (0x58)
- key_signature (0x59)
- sequencer_specific (0x7f)
- Unknown Meta Messages
- Implementing New or Custom Meta Messages
- Supported Messages
- Resources
- Freezing to EXE File
- Version Changes
- Release History
- 1.3.0 (2023-07-21)
- 1.2.10 (2021-05-10)
- 1.2.9 (2018-10-05)
- 1.2.8 (2017-06-30)
- 1.2.7 (2017-05-31)
- 1.2.6 (2017-05-04)
- 1.2.5 (2017-04-28)
- 1.2.4 (2017-03-19)
- 1.2.3 (2017-03-14)
- 1.2.2 (2017-03-14)
- 1.2.1 (2017-03-10)
- 1.2.0 (2017-03-07)
- 1.1.24 (2017-02-16)
- 1.1.23 (2017-01-31)
- 1.1.22 (2017-01-27)
- 1.1.21 (2017-01-26)
- 1.1.20 (2017-01-26)
- 1.1.19 (2017-01-25)
- 1.1.18 (2016-10-22)
- 1.1.17 (2016-10-06)
- 1.1.16 (2016-09-27)
- 1.1.15 (2016-08-24)
- 1.1.14 (2015-06-09)
- 1.1.13 (2015-02-07)
- 1.1.12 (2014-12-02)
- 1.1.11 (2014-10-15)
- 1.1.10 (2014-10-09)
- 1.1.9 (2014-10-06)
- 1.1.8 (2014-09-29)
- 1.1.7 (2014-08-12)
- 1.1.6 (2014-06-21)
- 1.1.5 (2014-04-18)
- 1.1.4 (2014-10-04)
- 1.1.3 (2013-10-14)
- 1.1.2 (2013-10-05)
- 1.1.1 (2013-10-04)
- 1.1.0 (2013-10-01)
- 1.0.4 (2013-08-15)
- 1.0.3 (2013-07-12)
- 1.0.2 (2013-07-31)
- 1.0.1 (2013-07-31)
- 1.0.0 (2013-07-20)
- Release History
- Authors
- Licenses
- Acknowledgments
- Glossary