VOGONS


First post, by Stef

User metadata
Rank Newbie
Rank
Newbie

I have been toying recently with General Midi in DOSBox(-X), after I saw this video: https://www.youtube.com/watch?v=AfRItQFShtY

After checking with Duke Nukem 3D that I am getting the same results, I went on to try few more games that were laying around (Space Hulk, Raptor, Terminator Rampage) and result were mixed, but quite interesting. Also, since I generally tend to avoid using outside programs, like the mentioned Virutal Midi synth from the video, I was nicely surprised that DOSBox already has integrated synth (fluid synth) that can be tuned for sound fonts and it works well.

This got me wonder... in case some DOS game or program setup doesn't offer General MIDI, or you just want to simplify process of using General MIDI output (despite, I consider tinkering with setups as part of the charm), is it possible perhaps to set General MIDI at emulator level? My reasoning is, emulators tend to allow "out-of-box stuff", like graphic filters (hq2x, supereagle, etc), save state, and so on. In case of audio I hesitantly guess it may not matter who or what is playing the midi during emulation and emulator somehow intercepting the midi sound and converting it with specified sound font might be possible?

Reply 1 of 5, by Ringding

User metadata
Rank Member
Rank
Member

If the game can output Adlib music, you mean? This would require mapping FM parameters back to MIDI instruments somehow. Are there software libraries doing this? I guess it would require a large database of settings encountered in the wild.

Reply 2 of 5, by Stef

User metadata
Rank Newbie
Rank
Newbie
Ringding wrote on 2021-12-15, 08:20:

If the game can output Adlib music, you mean? This would require mapping FM parameters back to MIDI instruments somehow. Are there software libraries doing this? I guess it would require a large database of settings encountered in the wild.

Hmm, I meant usual sound blaster midi, don't know much about adlib (and I don't remember I ever saw the game that doesn't support sound blaster so its kinda stone standard in DOS). I am talking about the same outcome that happens when, for example, in Duke Nukem 3D setup, you switch music card from sound blaster to general midi and then set midi port to 0x330. If some game doesn't have option for general midi in the setup or doesn't have setup at all... I imagine you would most likely be stuck with sound blaster midi unless there is a way to output that sound blaster midi as "general midi with assigned sound font" through some higher-level-emulator hack (like the mentioned filters for graphics).

Reply 3 of 5, by Ringding

User metadata
Rank Member
Rank
Member

Yes, Sound Blaster music is the same as Adlib (and very similar if they use OPL3, which was available starting with SBPro 2, IIRC).

Reply 4 of 5, by ericvids

User metadata
Rank Newbie
Rank
Newbie

The first Sound Blaster was originally developed as a competitor for the AdLib card. Creative did this by using the exact same FM synthesizer chip (Yamaha OPL2) that was on the AdLib to achieve backward compatibility, then added their own digitized sound processor (PCM) to one-up the AdLib, but that part doesn't add anything new to the FM portion of the card. So for all intents and purposes, AdLib FM synthesis is essentially identical to Sound Blaster 1.0 FM synthesis. Later, the Sound Blaster Pro 2 and the AdLib Gold upgraded to OPL3, but the AdLib Gold has a different digital PCM engine and didn't gain much market traction.

OPL technically has no "General MIDI" nor even "MIDI" support, only FM synthesis controlled via hardware registers. What really happens is that either games wrote directly to the OPL registers (e.g., LucasArts SCUMM games, Wolfenstein 3D) or used a sound library to convert General MIDI to OPL (e.g., DOOM using the DMX sound library by Paul Radek, and Duke Nukem 3D using the Apogee Sound Engine).

The conversion from General MIDI to OPL is lossy -- each instrument's properties are converted to OPL parameters (waveform type/operator, attack/decay/sustain/release, etc.). In practice, a given set of OPL parameters may be reused by multiple instruments, making it impossible to recover the original GM data.

There is a project that attempts to convert OPL music data back to General MIDI called dro2midi, but it requires user intervention to supply a GM instrument map for each OPL patch in a given song.

My own project, wolfmidi, specializes on the Wolfenstein 3D music files, using initial patches from Bobby Prince's released MIDI files and assigning the other patches in a global manner for consistent sound. You will notice that while wolfmidi's music files are "consistent" with regards to the OPL music in the game, they don't sound exactly the same as Bobby Prince's actual MIDI files (although it is partly because he modified his MIDI files to sound good on an SC-55 before releasing them).

Reply 5 of 5, by Stef

User metadata
Rank Newbie
Rank
Newbie

Thanks for explanation 😀 And the way I understand it, what I was asking about is not impossible but it is very hard to achieve.

I only ever knew Sound Blaster in DOS, then I got acquainted with Roland in DOSBox and ScummVM, and as of recently this General MIDI with various sound fonts. I only remember other outputs, such as Adlib or Gravis Ultrasound, as choices in various setups of various games.

I have been also experimenting by running various MIDIs in DOSMID program. It works well and as expected according to DOSBox config in "midi" section. It gives me the full picture of how some MIDI would sound through SB/Adlib FM, MS Wavetable, Roland or Fluid synth with assigned sound font, in DOSBox.