It's purpose is to remove unnecessary commands from IMF files to reduce the file size. It is based on the same optimizations that the MIDI2IMF converter performs to make a file smaller. This program can also convert IMF songs to a different playback rate and/or convert the song from plain IMF format into AudioT chunks and back, and truncate the song.
Simply fire up a CMD and type:
IMFCRUSH <infile> <outfile> [OPTIONS]
Recognized options are:
/keepfirst keep instructions that use the first voice/channel (the first voice is usually reserved for AdLib sound effects) /keepdummy keep instructions that get overwritten in the same cycle /keepredundant keep instructions that write the same value that's already in the AdLib register /keepall combination of /keepfirst /keepdummy and /keepredundant /chunk saves an AUDIOT chunk instead of a plain IMF file /convert <fromRate> <toRate> converts the song to a different rate /truncate <startSample> <stopSample> keeps only samples from <startSample> until <stopSample> /fixdro fixes issues in IMF files created by DRO2IMF
The IMF data is processed up to three times to eliminate any unnecessary instructions and thus reduce the size of the resulting IMF file:
The first run removes all instructions that write data for the first OPL voice (also referred to as "channel"). Almost all games using the IMF format use the first voice to play AdLib sound effects. IMF songs should not use the first voice to begin with, but the original IMF songs usually reset ALL voices at the beginning of the song. The resetting of the first voice is not required and might even interfere with the sound effects as it turns the currently played note off and resets the instrument. Removing these commands is usually totally harmless and reduces the total file size by 52 bytes.
The second run removes all instructions that write data to registers that are overwritten in the same IMF cycle. The only exception are the registers 0xB0 to 0xB8 and 0xBD. They must always be written, otherwise a sequence of short notes might get merged into a single, long note.
The third run removes all instructions that try to write the same data to a register that is already stored in the register.
I It's not guarantee that these runs won't remove any important AdLib FM chip commands. So the
/keep... options can be used to disable these runs.
The DRO format expects all AdLib registers to be set to 0 at the beginning of the song and the DRO2IMF tool does not take that into account when converting the data into IMF format. This means that files created by DRO2IMF sound differently depending on the actual values stored in the AdLib registers when the song starts. Playing the song in a loop may also cause it to sound differently when the song restarts.
/fixdro option adds instructions at the beginning of the IMF song that set all valid AdLib registers to 0, so the IMF file can be played properly.