Imf support?

Moderator: GZDoom Developers

Ajapted
Posts: 71
Joined: Sat Apr 16, 2005 3:50 am
Location: Tasmania

Post by Ajapted »

jallamann wrote:Sadly, IMF2MID doesn't work on the Major Stryker IMFs
Not at all, or just sounds bad?
User avatar
jallamann
Posts: 2271
Joined: Mon May 24, 2004 8:25 am
Location: Ålesund, Norway
Contact:

Post by jallamann »

Enjay wrote:(Hmmm, I wonder why there was never a Keen 3D?)
Mostly because id Software doesn't want to make Keen games, and the person that wants to make Keen games, Tom Hall, is no longer at id. As long as id has the copyright/trademark, Tom Hall is unable to do anything, unless id allows him to do it.
Ajapted wrote:Not at all, or just sounds bad?
Not at all. It outputs a MIDI file that has a 1 second duration with no notes or instruments.
Ajapted
Posts: 71
Joined: Sat Apr 16, 2005 3:50 am
Location: Tasmania

Post by Ajapted »

There are apparently two slightly different IMF formats, but IMF2MIDI only handles one, so that may explain it.
User avatar
randi
Site Admin
Posts: 7749
Joined: Wed Jul 09, 2003 10:30 pm
Contact:

Post by randi »

Did it, now that I know IMF is little more than a raw dump of OPL commands. Adding support for it was very easy, since I already had code to handle RDosPlay's RAW files. IMFs are essentially a more limited version of the same thing.

However, there are actually three IMF formats. I have chosen to support only one of them: The type with a header, so it can actually be identified automatically. If you have a hex editor, converting from the other two formats is extremely simple:
  1. If your file starts with the five letters "ADLIB", you don't need to do anything. It already has the header.
  2. If either of the first two bytes of the file are non-zero, insert two zero bytes after the first two bytes. Otherwise, add four zero bytes at the start of the file.
  3. At the start of the file, insert the following nine bytes (in hexadecimal): 41 44 4C 49 42 01 00 00 01
  4. If you did steps 2 and 3 correctly, your file should now be eleven or thirteen bytes larger than it was before.
Example, from a Corridor 7 song.

For this song, the first 32 bytes are:
00 00 00 00 BD 00 00 00 08 00 00 00 20 00 00 00
23 00 00 00 40 0B 00 00 43 00 00 00 60 A8 00 00
This is headerless, so we need to convert it using steps 2 and 3 above.

Step 2. The first two bytes of this file are both zero, so add four more zero bytes to the start of the file. The first 32 bytes of the file now look like this:
00 00 00 00 00 00 00 00 BD 00 00 00 08 00 00 00
20 00 00 00 23 00 00 00 40 0B 00 00 43 00 00 00

Step 3. Insert nine bytes at the start of the file. The first 32 bytes of the file now look like this:
41 44 4C 49 42 01 00 00 01 00 00 00 00 00 00 00
00 BD 00 00 00 08 00 00 00 20 00 00 00 23 00 00

This song has now been converted to the IMF-with-header format. It has grown thirteen bytes in size.

Here is another example from a different song (titlermx.imf).

This time, the first 32 bytes are:
90 2F 00 00 00 00 01 00 00 00 02 00 00 00 03 00
00 00 04 00 00 00 05 00 00 00 06 00 00 00 07 00

Step 2. The first two bytes are not both zero, so insert two zero bytes after them. The first 32 bytes of the file now look like this:
90 2F 00 00 00 00 00 00 01 00 00 00 02 00 00 00
03 00 00 00 04 00 00 00 05 00 00 00 06 00 00 00

Step 3. Add the nine header bytes to the start of the file, which leaves the first 32 bytes looking like this:
41 44 4c 49 42 01 00 00 01 90 2f 00 00 00 00 00
00 01 00 00 00 02 00 00 00 03 00 00 00 04 00 00

This file is now also in IMF-with-header format. Unlike the first example, it has grown only eleven bytes because we only needed to insert two zero bytes for step 2.
Last edited by randi on Mon Sep 19, 2005 6:48 pm, edited 1 time in total.
User avatar
Bashe
Posts: 1680
Joined: Mon Nov 10, 2003 11:32 am
Location: Ohio
Contact:

Post by Bashe »

Cool. Now we can have the original Wolf3d and Blake music in mods for those games!
Cptschrodinger
Posts: 380
Joined: Thu Oct 21, 2004 5:27 pm

Post by Cptschrodinger »

O.O It got in?!?!??!
User avatar
jallamann
Posts: 2271
Joined: Mon May 24, 2004 8:25 am
Location: Ålesund, Norway
Contact:

Post by jallamann »

:D:D:D:D:D:D:D:D:D:D:D:D:D:D:D:D:D:D
User avatar
MartinHowe
Posts: 2067
Joined: Mon Aug 11, 2003 1:50 pm
Preferred Pronouns: He/Him
Location: East Suffolk (UK)

Post by MartinHowe »

randy wrote:Did it, now that I know IMF is little more than a raw dump of OPL commands. Adding support for it was very easy, since I already had code to handle RDosPlay's RAW files. IMFs are essentially a more limited version of the same thing.
Has AFADoomer offered to have your babies yet? :D
User avatar
jallamann
Posts: 2271
Joined: Mon May 24, 2004 8:25 am
Location: Ålesund, Norway
Contact:

Post by jallamann »

Maybe I've done something wrong, but I tried editing one of the Major Stryker IMF's, but now it plays at like 150% speed and is over twice the total lenght, but only silence after the last note :?
User avatar
Shadelight
Posts: 5113
Joined: Fri May 20, 2005 11:16 am
Location: Labrynna

Post by Shadelight »

if you people get too excited he might take it out ;)
User avatar
TheDarkArchon
Posts: 7656
Joined: Sat Aug 07, 2004 5:14 am
Location: Some cold place

Post by TheDarkArchon »

WTF?!?!
Cptschrodinger
Posts: 380
Joined: Thu Oct 21, 2004 5:27 pm

Post by Cptschrodinger »

Uhh... King... You said you were gonna stop that shit.
User avatar
AFADoomer
Posts: 1341
Joined: Tue Jul 15, 2003 4:18 pm
Contact:

Post by AFADoomer »

MartinHowe wrote:Has AFADoomer offered to have your babies yet? :D
I wouldn't go THAT far...

Though we never really established if randy was male or female...
User avatar
MartinHowe
Posts: 2067
Joined: Mon Aug 11, 2003 1:50 pm
Preferred Pronouns: He/Him
Location: East Suffolk (UK)

Post by MartinHowe »

AFADoomer wrote:
MartinHowe wrote:Has AFADoomer offered to have your babies yet? :D
I wouldn't go THAT far...

Though we never really established if randy was male or female...
Heh. Do we know if he's even human :)

Joking apart, every wolf TC I've ever seen has been let down by the music, because only some of the original MIDIs were available (from BP's web site), others had to be replaced or approximated, and even the IMF extractor and player had lots of limitations. I imagine that for wolf TC authors such as yourself, IMF support based on actually emulating the adlib hardware could be very cool...
User avatar
AFADoomer
Posts: 1341
Joined: Tue Jul 15, 2003 4:18 pm
Contact:

Post by AFADoomer »

Very true. I was only able to find a few of the original MIDIs, and the IMF2MID program conversions sucked.
Post Reply

Return to “Closed Feature Suggestions [GZDoom]”