fraggle
Super Moderator

Posts: 5904
Registered: 07-00 |
Super Jamie said:
That's one thing I've never been able to understand. If you're using OPL3 hardware to playing the Doom songs with Doom's OPL3 instrument files, how come it doesn't sound like Doom? MUS Play under DOS is the same, even on actual SB16 with YMF262.
The thing to understand is that the OPL isn't a "MIDI chip". It doesn't do hardware MIDI. All it provides is 11 voices, which are essentially just like synthesizers with knobs that you can twiddle. If you want to play a MIDI file, you set the knobs to the right values and it makes sounds that correspond to the notes you want to play.
The OPL patches in the GENMIDI lump make up the majority of what those knobs need to be set to, but not all of them. For example, what frequency register values should be used for each of the MIDI notes? The documentation I read says this:
code:
In octave 4, the F-number values for the chromatic scale and their
corresponding frequencies would be:
F Number Frequency Note
16B 277.2 C#
181 293.7 D
198 311.1 D#
1B0 329.6 E
1CA 349.2 F
1E5 370.0 F#
202 392.0 G
220 415.3 G#
241 440.0 A
263 466.2 A#
287 493.9 B
2AE 523.3 C
Doom uses this (compare with "F number"):
code: 0x204, 0x223, 0x244, 0x266, 0x28b, 0x2b1,
0x2da, 0x306, 0x334, 0x365, 0x398, 0x3cf,
Note frequencies are probably the main thing, but other things that are pretty arbitrary include the volume level to use, pitch bend, how to behave when you run out of voices, etc. MUSlib, the library used by NWT and CDoom, sounds almost exactly like Doom, probably because it uses the same note frequencies, but I've heard things even with that which don't quite match up.
To summarise, to get a source port to do OPL playback like Vanilla Doom, you have to (1) use Doom's GENMIDI patches, (2) program the OPL in exactly the same way as Doom, (3) use a real hardware OPL or an accurate OPL emulator.
|