IMF2WAV
Developer(s) | K1n9_Duk3 |
---|---|
Initial release | 2013-02-14 |
Latest update | 2020-05-10 |
Development status | Finished |
Programming language | C++ |
Platform | CLI |
License | GPL |
Tool Type | Audio Editor |
Engine(s) | Keen:Galaxy (any raw IMF file) |
Homepage | http://k1n9duk3.shikadi.net |
Discussion(s) | PCKF Discussion Thread |
Download | Version 1.2 (Source Code included) newest mirror |
IMF2WAV (aka IMF to WAV converter) is a Win32 bit based tool to convert any IMF file to Wave format created by K1n9_Duk3. It uses the MAME OPL emulator (fmopl.cpp, fmopl.h) and is based on Wolf4SDL. This tool can also be used by other applications that need to play IMF music but cannot use built-in OPL emulation.
- Note: These might require the MS Visual C++ 2008 Runtime Environment in order to work properly.
Usage
Simply fire up a CMD and type:
IMF2WAV <imffile> [wavefile [imfrate [hertz [mask]]]]
Parameters
The parameters wavefile
, imfrate
, hertz
and mask are optional. The brackets indicate that if you want to set imfrate
, you have specify wavefile
as the second argument. Same applies to hertz
and mask
. wavefile
is the name of the output file and defaults to <imffile>.wav, imfrate
defines how many times per second new commands are sent to the OPL emulator and defaults to 560. hertz
defines the sample rate of the resulting wave file and defaults to 44100.
mask
defines which AdLib channels should be played and defaults to -1 (all channels). Each bit in the mask value indicates the state of an AdLib channel.
The lower 9 bits (1, 2, 4, 8, 16, 32, 64, 128, 256) are for the regular AdLib channels, the next 5 bits (512, 1024, 2048, 4096, 8192) represent the rhythm mode channels. To combine these bits, simply add the corresponding values.
Examples
This converts "apogfnf1.imf" to "apogfnf1.imf.wav":
imf2wav apogfnf1.imf
This converts "apogfnf1.imf" to "fanfare.wav":
imf2wav apogfnf1.imf fanfare.wav
This converts Duke Nukem II's "fanfarea.imf" to "fanfare.wav":
imf2wav apogfnf1.imf fanfare.wav 280
This converts Wolfenstein 3D's "pacman.imf" to "pacman.wav" at 22050 Hz:
imf2wav pacman.imf pacman.wav 700 22050
This converts all rhythm mode channels from "main.imf":
imf2wav main.imf main.wav 560 44100 15872
Creating single-channel WAV files from an IMF song
In the download folder there is a batch file (imf2wavs.cmd) included that will convert an IMF song into several single-channel WAV files. It basically runs imf2wav.exe 14 times to create 14 WAV files.
This will convert "main.imf" to multiple single-channel WAV files:
imf2wavs main.imf
The resulting files will be named "main.imf-01.wav" to "main.imf-14.wav".
- Note: any WAV file that contains nothing but silence will automatically be deleted by this batch file.
The imfrate
and herz
settings are not passed to the batch file. Therefor the "imf2wavs.cmd" file must be edited (right-click and select "edit") and change the settings in the batch file itself.
You should also know that you cannot drag and drop IMF files onto the batch file as it is. If you want to be able to do that, you must edit the batch file and replace the "imf2wav.exe" in the line set IMFCONV=imf2wav.exe
with the full path of your imf2wav.exe. So if you copied the files into a folder like
"D:\IMFstuff\converter", you must change that line in the batch file to this:
set IMFCONV="D:\IMFstuff\converter\imf2wav.exe
Save the batch file and drag your IMF song onto it. It should now create a WAV file for each channel that is used in the IMF song.
Notes
- This program converts IMF music to PCM waveform data using an OPL emulator, and saves the converted data as a .WAV file.
- In its current implementation, the IMF converter does not suffer from the same 64K limits as the playback routines in the original DOS games. Any IMF file can be converted, as long as there is enough free space for the resulting WAV file.
- The source code was compiled with Microsoft Visual C++ 2008, building a Win32 console application with the default options.