MTM Background History Documentation Download

MTM - A Midi to Mup Conversion Program

MTM is a utility program, written in C for use under Linux (and probably under most variants of Unix). Its sole purpose is to convert a MIDI file into MUP.

It comes with no warranty, and may not do what you would like it to do, but it probably comes closer than any other program that I have seen. I have made it available to the wider community as a 'work in progress' and will update it as and when I get time and inspiration to do so.

It is downloadable as a source archive (gzipped tar file) so that you can compile it for whatever system you please. Feel free to modify it, but please don't market it as MTM if you have modified it.

Some Background

MTM was originally written by Sean Gilley. I downloaded the original from the MUP Website, where it is now no longer available. It could only handle 'single-note' MIDI files, which was of little value to me, but it got me started. Since then I have almost totally re-written the program, so there is little of the original code remaining. Many thanks to Sean for the original impetus to develop the current version.

The program is now capable of handling almost anything, though every time I produce a new version someone immediately finds another MIDI file that gives problems. I'm philosophic about this. If you find a MIDI file that crashes MTM or for which the output is rejected by MUP, then I'll be glad to hear from you - email me 'bill at billp.org' with the details, including the MIDI file (or URL if it's on the web), and I'll see what I can do. Don't expect overnight fixes (though they have happened), and sometimes the problem is just too hard for me to figure out a way of handling it.

At present there is a problem with MTM that I've been unable to resolve. If there are two notes a semitone apart, say A and A# which occur at the same time, then this is not acceptable to MUP, and my 'work-around' is to edit the A# to Bflat by hand. Of course making it Bflat all the time isn't a solution as then you'd get a conflict if it occurred along with a B. It sounds easy in principle to choose whichever one eliminates the problem, but in practice it seems to be very difficult. Maybe my internal data structures need an overhaul. I keep toying with ideas to get around it but have yet to come up with a 'good' solution.

Revision History

I've only really started thinking about project management after about 5 years of tinkering. I can't remember the exact dates or the details of what I changed when. I am now trying to manage this properly so here is a revision list with some speculative (and probably fictional) early dates:
DateReleaseComments
??/??/199?1Acquired original code from MUP website
Made lots of changes to handle multiple notes per track etc.
23/06/20041.5?First release via MUP-user mailing list.
15/11/20052.0Major rewrite of MTM, fixed lots of problems, several significant improvements
17/11/20052.0aMinor quick bugfix.
22/11/20052.1Further bugfixes, extended translate facility, introduced dynamic quantisation.
27/11/20052.1.1Bugfix release. Fixed problems, mainly relating to syntax and interpretation of control files, plus extended range of command-line options.
14/01/20062.2Major rewrite of various sections of code. Tracks are allocated as needed rather than statically at compile time. Note pitches are determined differently, in a separate scan of the file, rather than as it is output, in order to detect and try to resolve conflicts which previously led to MUP errors. Rest length now depend on the time signature. Beamstyles can now be specified for individual tracks. Additional command options to specify control file name, and lead-in adjustments.
27/03/2006 2.2.2 Minor bugfixes. Corrected problem in handling format 0 midifiles, caused by trying to improve internal memory allocation but not allowing for the quirks in handling format 0 files.
02/07/2007 2.2.3 Minor bugfixes. Problems with 6/8 time pieces being formatted as if 3/4 time. Corrected.
20/10/2008 2.3 Significant rewrites of some parts. Split long notes at bar lines using ties during input of the midifile to simplify output. Added code to produce MUP lyrics statements, either using embedded lyrics events or generating dummy ones which can easily be editted by hand.

Remove the built-in table that determines accidentals and replace it with a data file which can be customised to the users personal taste.

20/06/2013 2.4 Bugfix release. Problem causing 'floating point exception' when invoked with -a4.
21/06/2013 2.4.1 Bugfix release. Modified mtm.c and Makefile to access the notelist file according to the user choice as defined in the Makefile.
28/06/2013 2.4.2 Further bugfixing. Added the '-t timesig' option to the command line to allow users to override erroneous time signatures in the midifile.
19/11/2014 2.5.2 An interesting bug arose, report by Martin Tarenskeen, he was having a problem with some MIDI files for which MTM declined to output one of the tracks. It turned out that there were notes in track zero, which I had always understood to be reserved for control events (time signature, tempo, etc.) but it seems that this is not the case. I fixed the bug and produced 2.5.1, but Martin also suggested improvements to the mapping of accidentals, which has always been a problem. By the time I had fixed that I had raised the version to 2.5.2 and 2.5 and 2.5.1 never reached the world.
26/01/2021 2.6.0 I regret that I can't recall what the latest version fixed, as it was several months ago, and I forgot to update this document, or upload the new version to the website. However, for what it's worth, here is the latest version!
27/01/2021 2.6.1 Problem raised by Martin relating to changes in GCC at release 10. I was still running 9.3 so hadn't seen what amounts to a significant chage in the rules about external symbols being implied by omitting 'extern' being no longer acceptable. Changed two variables that were in this category.

Downloads

The program is only distributed as 'C' source code, in gzipped tar files. With the release of 2.1 I am keeping older versions available for a while.
Version 2.6.1
Version 2.6.0
Version 2.5.2
Version 2.4.2
Version 2.4.1
Version 2.4
Version 2.3
Version 2.2.3 (2.2.2 plus a minor bugfix)
Version 2.2.2 (2.2 plus bugfixes)
Version 2.1.1 (2.1 + bugfix)
Version 2.1
Version 2.0a (Version 2.0 + bugfix)

Credits

I'd like to include some thanks here. Firstly to Sean Gilley as originator of the original version.

Secondly, to those who have recently tried mtm and sent in comments: particularly Martin Tarenskeen, Ted Harding, Christian Mondrup, Marshal Jose, Charles Cave, Bob van der Poel, Barrie Stott. If your name isn't here, and you feel it ought to be, do send me a reminder!


Page created by Bill Purvis, last update 26th January, 2021.