Midifile Utilities
For your possible interest, I thought I’d list the (command-line) utilities that
I’ve found useful for working on standard midifiles at various points in time.
Some are my own, most not, but they are all freely distributable and available
on the web. Those written by others have links to the authors’ sites, rather
than having — possibly outdated — copies maintained here.
They are all cross-platform, but may have to be compiled for your system.
The one I use most regularly is my own ‘GMlister’ that outputs a text listing
of all the events in a midifile, oriented to the General MIDI standard. Others
that see fairly frequent use are the ‘midicsv/csvmidi’ pair, which convert between
midifiles and ‘comma-separated-value’ text that can be read and manipulated by
both text editors and spreadsheet apps. ‘tempomap’ has been indispensable in
one situation — so far! — to turn a freely-recorded piece into
something manageable by a sequencer.
The utilities are listed by source:
midicsv:
- midicsv
- — create a CSV text file from a standard midifile
- csvmidi
- — create a standard midifile from a CSV file
The CSV (comma separated value) file created by midicsv
is a useful (complete) text representation of a standard midifile,
as it can be worked on in either a text editor or in a spreadsheet to make
changes that can then be read by csvmidi to generate a revised midifile.
Find these at:
http://www.fourmilab.ch/webtools/midicsv/
midifile_rb:
- GMlister
- — list the contents of a General MIDI midifile
track by track
- GMsummary
- — summarize the contents of a General MIDI midifile
by channel
- SMFformat0
- — create a Format 0 (single-track) midifile
from Format 1 (multi-track)
- SMFformat1
- — create a Format 1 midifile from Format 0
(one channel per track)
- SMPTEtoSMF
- — create a midifile with standard PPQN ticks from SMPTE ticks
- Transpose
- — create a midifile with all notes (except percussion) transposed
These are various little Ruby scripts (and hence need ruby installed on your
system) that I wrote, that use my midifile.rb ruby library.
And I just added three more (February 2010):
- ChanTran
- — Change the channel of events
- Quantize
- — Align events on division
- Resustain
- — Replace Sustain pedal with
suitably lengthened notes
The above set are all provided as examples in the midifile.rb package
on this site at
http://www.GoodeveCA.net/midifile_rb/
- midi2sco
- — create a Csound score file from a midifile
This utility is aimed only at people working with the Csound
music synthesis application. It creates a Csound ‘score’ file from a midifile,
or from selected instruments in it. It also requires the midifile.rb
library but, being more specialized, has its own page:
http://www.GoodeveCA.net/midi2sco/
tempomap
This provides a way to clean up the rhythm and tempo of a midifile that
was recorded ‘live’ —i.e. without concern for sequencer beats and bars.
It is an extension of one of Div’s MIDI utilities (see below), and can be
found here:
http://www.GoodeveCA.net/tempomap/
abcmidi:
- midi2abc
- — create an ABC text file from a standard midifile
- abc2midi
- — create a standard midifile from an ABC text file
- midicopy
- — copy a midifile, or selected portions
- yaps
- — create a PostScript file from an ABC file
‘ABC’ notation is a scheme for representing standard music notation
as ASCII text. It is probably most useful as a source for generating music
manuscripts, and there are many programs around that do this via TeX or PostScript
(yaps is one of them). The above converters can be used to get an ABC file
out of a midifile, or to create a midifile from ABC (though the result of the
latter may be a bit mechanical…).
I have also used midicopy a few times to cut desired sections from
a midifile — getting the required tick counts from a GMlister
or midicsv record of the file.
http://abc.sourceforge.net/abcMIDI/
http://ifdo.pugmarks.com/~seymour/runabc/top.html
Div’s MIDI:
- smftoxml
- — create Div’s XML format file from standard midifile
- xmltosmf
- — create standard midifile from Div’s XML format file
- …etc.
- — other various more specialized programs
Div (David Slobin) has various utilities on his site. Some work on piped MIDI
streams in unix/linux, others use specific features of Windows. The above
(platform independent) pair have a similar function to midicsv/csvmidi,
but use an (individual) XML format rather than CSV.
http://public.sreal.com:8000/~div/midi-utilities/
Peter Billam's Scripts:
Peter Billam in Australia has some interesting utility scripts on his website.
They variously run under Perl, Python, or Lua, but are mostly oriented to the
Linux user; many require Linux's ALSA-MIDI, and so probably will not run under
other OSs. He has a MIDI editor (in Perl) that runs in a Linux Terminal window,
for example, but there are many others — too many to list here, so take
a look at his pages yourself:
http://www.pjb.com.au/midi/