MOD2MIDI
Description
Mod2Midi is a program that converts ProTracker module files (.MOD) to standard MIDI (.MID) format. Because there is not a one-to-one correspondance between the two formats, an additional Module Definition File (.MDF) can be supplied by the user to aid conversion. With this file, the user can define channels and program numbers for each instrument. Also, the program can be set to produce a Sonitica file (.SON) that can be used by the Sonitica compiler to play the resulting MIDI file.

The default operation of mod2midi is to give each instrument in the .MOD file a separate logical track in the MIDI file, a separate program number, a separate channel number (up to channel 15) and to cut off when interrupted by another instrument, just like it does in the .MOD file.
Usage
mod2midi <infile>[.mod] <outfile>[.mid] [-idso] [-n<pathname>]

-I	Show module information only

This option will display the title of the .MOD file, a list of all the instruments and their sizes (in bytes), loop start position, and loop end position. This information can be used in creating Module Definition Files. If this option is set, no output files will be written.

-D	Use Module Definition File

If this option is set, the converter will look for a .MDF file with the same path and name as the original .MOD file. The format of this file is described below.

-S	Create Sonitica language file

-N <dirname>	Set directory for output sample files

-O	One voice for each instrument
Module Definition Files
A .MDF file simply consists of several lines, one for each instrument in the .MOD file that you which to describe. Each line consists of one or more keywords, each of which is optionally followed by the parameters for that command. Blank lines are ignored. Comments may be added to the end of a line with two slashes followed by the comment. For example, here is a typical line out of a .MDF file:

inst 4 chnl 10 prog 47 transpose 12          // timpani

The first command, inst, specifies that the line describes instrument number 4 of the midi file. The second and third say that it should be placed on MIDI channel 10, and given program number 47. The fourth command transposes the instrument 12 half-steps higher. The comment reminds the user of the actual sound of the instrument, which is a timpani in this case.
Midi Conversion Commands
These parameters are responsible for the way the notes of the .MOD file are converted into MIDI format.

inst <1..31>

The first command on each line of a .MDF must be inst, followed by a .MOD instrument number. This specifies what instrument of the module file the line will describe.

chnl <0..15>

This command places all notes played by the specified instrument on a given MIDI channel. If this parameter is omitted, the program assigns instruments to channels in ascending order.

note <0..127>

This command

prog <0..127>

This command assigns the current instrument to a MIDI program number.

transpose <-127..127>

This command transposes all notes produced by the current instrument a given number of half-steps.

sametrk

This command, taking no parameters, specifies that the current instrument should be placed on the same MIDI track as the previous instrument. If this parameter is omitted, the instrument is given its own track in the MIDI file.

persist

This command makes the current instrument persistent. That is, Note Off messages will not be sent to the instrument. This command is usually used for percussion instruments.
Sonitca Output Commands
These commands dictate the content of the generated Sonitca file when the -s option is used. If the option is not set, these commands will simply have no effect.

voices <1..???>

This command specifies how many tone generators (voices) will be used for a given instrument in the Sontica file. If this option is omitted, the program will try to guess the number of voices needed by counting how many different .MOD tracks the instrument is played on. Note that for percussion instruments, it is usually good to have more than one voice, in order to allow the instrument its full decay time.

pan <-1.0 .. 1.0>

This command takes a real number as a parameter, and pans the instrument to the left or right in the Sonitica file. -1.0 is full left, 1.0 is full right, and 0 is dead center. This command will not generate any Control Change messages in your MIDI file; it only affects the output Sonitica file.