fraggle
Filled with the code of Doom

Posts: 6607
Registered: 07-00 |
Gez said:
I'm not the most knowledgeable in this domain so correct me if I'm wrong, but aren't there basically two different steps for playing MIDI music as OPL?
Step 1: convert MIDI instructions to OPL instructions (using the GENMIDI lump)
Step 2: convert OPL data into actual sounds
I assume maybe incorrectly that step 1 is the easy part and the results shouldn't really differ between ports.
Broadly, yes. The OPL chip does not play MIDI - it is just a machine that makes noises. To do MIDI playback, you need some code that will read MIDI instructions and program the OPL to make appropriate noises for each instrument.
Doom's GENMIDI lump is a big table of OPL register values, one set for each MIDI instrument. When you want to play, eg. a finger plucked electric bass, the MIDI code looks up the entry for instrument #33, loads it into the OPL and makes it make a noise. Incidentally, this is why Boom's OPL playback sounded different to Doom - it used the Allegro sound library that had its own table of instruments.
You can get 90% of the way to sounding like Doom just by using Doom's instrument set, but there are still lots of subtle things you have to get right to sound just like Doom. For Chocolate Doom I used a precise analytical approach, where I used a modified version of DOSbox to dump all the OPL register writes to a log, then did the same for Chocolate Doom and compared the differences. So I can prove that, for some songs at least, the behavior is identical to Vanilla.
Partly, though it has been updated several times since. For instance in r872 and r1195. You can look at the full log.
Interesting, thanks!
|