Reading a MIDI File in Python

I want to be able to read events from a MIDI file in Python. I was looking for libraries, but I can not find the one that works with my MIDI file in windows. I don’t need to do anything in real time and just want a simple library to give me events and time. Would it be easier to write one for yourself? Any help would be appreciated.

+6
python midi
source share
5 answers

midi file structure is pretty simple. if you cannot find a ready-made library (I don’t know anyone) and you only need events and time, I suggest you analyze the file yourself.

(prepare for a large bit offset: MIDI data is stored in strings of 7 bit blocks)

In addition, you say that you cannot find a library that works with your MIDI file on Windows: the MIDI file must be portable, as well as python, so un * x lib should work equally well on windows (or the developer skipped the point as MIDI, so is python).

+6
source share

Check out this python library on github, it seems to do exactly what you need:

https://github.com/vishnubob/python-midi

+5
source share

I once wrote a simple library in pure C for reading / writing Midifiles. If you want to look here, this is: http://code.google.com/p/middl/

This is a low-level library that makes it easier to work with midi files, but you must be familiar with the Midi file format in order to use it.

+2
source share

It is best to get a c or C ++ library and interact with it using the Python Extension for c.

+1
source share

There is a library called mido that is good for reading these files: https://pypi.python.org/pypi/mido/1.1.11

+1
source share

All Articles