Skip to content


Switch branches/tags

Name already in use

A tag already exists with the provided branch name. Many Git commands accept both tag and branch names, so creating this branch may cause unexpected behavior. Are you sure you want to create this branch?


Failed to load latest commit information.
Latest commit message
Commit time


Fmidi is a library to read and play back MIDI files. It supports both standard MIDI files and RIFF MIDI files.

The functionality is exposed as a C programming interface, and it is implemented with C++.

It is a simple library which is good for implementing a MIDI file player, or any program taking MIDI files as inputs. In fact, a player with a terminal interface is provided as an example. Build it with ncurses, libev and RtMidi.

Design goals

This library is designed for excellent compatibility. Downloaded MIDI files often come as corrupted, incomplete, or non-standard in many ways. Fmidi has a permissive reader, which attempts repairs when errors are detected, without compromise on the MIDI file standard.

Quality comparison

Fmidi is tested on a collection of MIDI files and the results are displayed in the table below. The data gives an idea of the relative compatibility and robustness of the library.

Tests are performed under different libraries with AddressSanitizer and identical environments. Under each error situation, the data indicates the number of problematic files.

LibraryReading errorAddressSanitizer issueLeakSanitizer issue
Fmidi 0.12000
libsmf 1.3468265108
portsmf 22897970
libtimidity 0.2.549300
Total files86808