Not a long time ago, somebody asked in Linux-audio-users mailing list for a
commandline utility allowing MIDI to text conversion. I'm proud to introduce
you a set of tools from John Walker, who wrote and released it into the
public domain. I'm not involved in this project, only commissioned to
announce and spread the truth ;-)
There are two main programs: midicsv converts MIDI files into CSV (comma
separated values) text. The complementary work is done by csvmidi. The CSV
text is a very readable format for humans, and easy to process by Perl
scripts (or any other suitable programming tool). Several simple Perl scripts
are included showing how to do common tasks as transpose, extract and
generate MIDI sequences from scratch.
This software is well documented and bug free. It can be compiled for *NIX,
and WIN32 systems.