C++ library for parsing Standard MIDI Files

Download .zip Download .tar.gz View on GitHub

Downloading and Installing

Download the zip or tar file from the buttons at the top of the page and unpack and type make in the base directory of the midifile package. Or if you use git, download on the terminal with these commands:

git pull https://github.com/craigsapp/midifile
cd midifile


  1. Event timestamps can be converted between absolute or delta tick values with the MidiFile::deltaTicks and MidiFile::absoluteTicks functions.
  2. In absolute tick mode, messages can be inserted into tracks in any order and later sorted by timestamp with the MidiFile::sortTracks function.
  3. Multi-track files can be converted to a single track in a reversible process.
  4. Event performance times in seconds can be calculated from tick times and tempo meta messages with the MidiFile::doTimeAnalysis function.
  5. Durations of notes can be extracted using the MidiFile::linkNotePairs function.


Class documentation

MidiFile:: Main interface for reading/writing Standard MIDI Files

    MidiEventList:: MidiFile track storage for MidiEvent lists

      MidiEvent:: (also inherits from MidiMessage) MidiMessage + timestamp

        MidiMessage:: (also inherits from vector<uchar>)

          Options:: Auxiliary class for command-line option parsing

          Binasc:: Helper class for ASCII MIDI file parsing