midilog-0.1: MIDI logging of practice sessions


If you play keyboard and practice on an instrument that features MIDI output, it’s quite feasible to save all your practice sessions, using standard MIDI files (which are very compact). This program does just that!

For me, it’s nice to have a record of my progress over the years. It’s also nice knowing that if I ever lose interest and my skill starts to erode, or I am otherwise unable to play anymore, that I will have a few recordings representative of the zenith of my skill level. Lastly, knowing that every note is being recorded seems good for working on my performance confidence.

In Linux, just “make”. Since I used the RtMidi library, a Windows port would be possible, in theory.

midilog-0.1.tgz (GPL)

midilog version 0.1 for GNU/Linux, released under the GPL v. 3 or later license (see LICENSE)
RtMidi licensed under its respective license

by geekamole, 2011

usage: midilog LOG_DIR PORT_NAME

e.g., ./midilog /files/midilogs "MidAir:0"

This program is intended to run as a daemon. It looks for the specified PORT_NAME among the input ALSA MIDI ports on the system. It then waits for input on the port, and creates timestamped standard MIDI files in the specified LOG_DIR corresponding to periods of input.

I created this to work with my Yamaha P80 digital piano, to record all my practice sessions. It may require tweaking for other instruments. Sys-ex messages and all other events are saved, but the one-per-millisecond status updates from the P80 are filtered out. After 10 minutes of note/sysex inactivity on the port, or 2.5 seconds of missing millisecond status messages on the port (indicating the piano was turned off), the MIDI file is closed out and midilog prepares to create a new file when needed.

All MIDI messages are saved to a single track.

Somehow, when I created this I was unaware of the program "arecordmidi," which might have allowed me to avoid learning about the MIDI file format. However, studying the format allowed me to select parameters to guarantee 1/2 millisecond resolution at 120 bpm.

The included version of the RtMidi-1.0.11 library was slightly modified to signal when a MIDI port is no longer available. midilog then periodically attempts to reconnect to the port.

What the files look like:

MidiLog_20101031__1927_51.mid

Leave a Reply

Your email address will not be published. Required fields are marked *