Header-only MIDI Sequencer code which can play MIDI, XMI and MUS files
  • C++ 98.2%
  • C 1.8%
Find a file
2026-04-18 01:49:50 +03:00
examples Added MIDI Dump example: print all events at the opened music file 2025-11-15 16:01:10 +03:00
include mididata_impl.hpp: Fixed incorrect loop end time reported 2026-04-18 01:49:50 +03:00
test_files Initial state 2019-12-03 17:08:30 +03:00
.gitattributes Initial state 2019-12-03 17:08:30 +03:00
.gitignore Initial state 2019-12-03 17:08:30 +03:00
LICENSE.txt Update copyright year for 2026 2026-01-01 02:16:52 +03:00
README.md Large update 2025-11-15 15:57:15 +03:00
TODO.txt Added TODO.txt reminder 2025-11-15 16:01:18 +03:00

A header-only MIDI sequencer for C++

Features

  • Support for streaming of MIDI, MUS, HMI, HMP, XMI (via built-in XMI2MID).
  • For the OPL2/OPL3 emulator using, it's possible to play IMF, KLM, and CMF files with OPL instrumentsshipped on aboard or streaming raw OPL commands.
  • Built-in loops support:
    • Final-Fantasy VII loops via "loopStart" and "loopEnd" markers.
    • RPG Maker way via CC111 as a "loopStart".
    • XMI native loops (for XMI files only).
    • Extended variant of Final Fantasy VII loops to support nested loops and loop counts ("loopStart=XXX" and "loopEnd=0").
  • Multiple devices support per track and the "device switch" event.
  • Full seekability (ability to see the current position, jump to certain point in any moment, see the full time length, see a range of loop).
  • Ability to load a file via file path or via memory.
    • NOTE: Acceptable file paths should be in UTF-8 even on Windows.
  • Compatibility with C++98 standard which can work on a bunch of older C++ compilers.

License

  • The code of sequencer is under MIT license
  • The code of "fraction.hpp" is in a public domain
  • XMI2MIDI is taken from WildMIDI project and there are licensed under LGPLv2:
    • If you want to use this MIDI sequencer with a MIT license, you should disable XMI suppory by removing of "impl/cvt_xmi2mus.hpp" file and declaring of next macros:
      • "-DBWMIDI_DISABLE_XMI_SUPPORT"

Usage tips

When you embed this sequencer into a static library, you should rename a class by declaring a next macro:

#define BW_MidiSequencer MyVeryCoolMidiSequencer

This is required to avoid a collision of ABI when using the same MIDI sequencer in multiple code files or when you are using this in a library project.

Development and contribution notice

The most active development of this sequence is going at the repository of libADLMIDI project and gets sometimes synced to here too. Commits here are pretty large. If you interested to see more detailed changelog, you might want to check out it from here. And therefore, And therefore the top state of this repository considered to be pretty stable and free from the rest of incomplete and experimental/unstable updates. You still can send pull-requests to this repository, and these changes will be synced back to the libADLMIDI, libOPNMIDI, libEDMIDI, and to the MixerX.