Lightning MIDI player

This article describes another step toward our goal of creating keyboard performance-enhancement software based on Yamaha styles. We have completed a module to interpret MIDI files, converting information to a set of timed MIDI signals to drive devices like the PSR E423 and 433 keyboards.

The MIDI file format evolved and congealed around 1991, a time of 8-bit microprocessors, limited RAM and modest storage capacity. Accordingly, the format was designed to represent all information as a sequence of bytes (8-bit numbers) and to occupy as little space as possible. The end result is a somewhat convoluted arrangement with plenty of tricks like bit masking and specialized large-number representations. The most charitable statement would be that the MIDI file format is not straightforward. Nonetheless, with patience and time, most programmers could come up with a way to ferret out the information and to send it as an organized stream.

The unique feature of our player module is that the exegesis of MIDI files is performed with unusually high efficiency and speed. The techniques build on our experience designing fast finite-element software to handle 10’s of millions of nodes. On loading the file, the module performs the following operations

  • Remove information that is not necessary for the receiving MIDI device.
  • Gather critical signals (e.g., NoteOn, NoteOff, SysEx,…) from all tracks and combine them into a single timed event sequence.
  • Store the sequence in memory in a form that requires minimal effort from the processor for transmission.

Efficient operation is crucial for a style performer that must follow chord leads in the bass, echo a melody line with a high-quality voice and respond to performance cues (switch style variation, insert a 2 beat measure, fade,…). With a low computational overhead for MIDI transmission, we can concentrate on sophisticated routines to interpret the player’s requests and to correct errors.

KBD-Infinity Simple MIDI Player and the SSynth MIDI File Player

Figure 1. KBD-Infinity Simple MIDI Player and the SSynth MIDI File Player

Figure 1 shows a screenshot of our Simple MIDI Player, a test program created with the module. The program plays one file at a time. (In the MIDI player that will be included with KBD-Infinity, users will be able to create and to save playlists, specify transitions between songs and view synchronized lyrics.) As a demonstration of the efficiency of our routines, I used a 200 kB test MIDI file containing the complete Goldberg Variations. Our program loads the file, organizes information and is ready to play in 0.52 seconds. On transmission, the program achieves a synchronization accuracy better than 1/1000 of a pulse. For a comparison, I loaded the same file with the SSynth Midi File Player ( The program delayed 13.6 seconds before the file was ready to play, over 25 times longer than our program.

To obtain MiniMIDI Player, please contact us at


[1] Find out more about KBD-Infinity: Home page.

[2] If you have comments, please contact us at

Comments are closed.