On Fri, Feb 19, 2010 at 11:13:51AM +0100, Emiliano Grilli wrote:
Oivvio Polite <mylists(a)polite.se> writes:
I'm looking for a commandline tool to
manipulate midi files
programmatically. One thing I want to be able to do is extract a range
of measures from a midi file, then repeat than range 10 times and put
the results onto a new midi file. It's alright if I have to do a
*little* programming rather then just giving commandline options.
Two tools come to mind:
First one is midish
http://caoua.org/midish/
The other is the MIDI-Perl module:
http://interglacial.com/~sburke/midi-perl/
This script for example does split SMF by track:
http://interglacial.com/~sburke/pub/midi_splitter.pl
The problem I see with moving ranges of measures in MIDI files is that
some commands might be issued at the beginning of the SMF, such as
program changes, controller changes, sysex and so on...: those might be
lost after an operation like you are describing.
midish is supposed to handle certain of these issues: when
moving measures around, it will save their context and merge
it with the context of the new position; so you'll always
get terminated notes and the proper state of controllers,
bender, aftertouch and so on. It will solve any conflicts
(e.g., "merge" duplicate controllers and handle nested
notes)
on the other hand, it will drop unknown events (e.g.,
lyrics, markers, smpte...) and move sysex messages into
banks played at the beginning.
-- Alexandre