Jump to content
Search In
  • More options...
Find results that contain...
Find results in...
T-Squared

BOOM/MBF IBK that mimics Doom's instruments?

Recommended Posts

I tried this on another forum a while back, but didn't get very good results. The Allegro sound library that's included with the sourceport does terribly with the instruments. They're okay, but if you want the real OPL/Soundblaster Doom music experience, then that's where it fails.

 

Does anyone have or know of a GENMIDI or other IBK that works with Boom or Marine's Best Friend?

Share this post


Link to post

I've just asked gerwin about GENMIDI and MBF 2.04, and he explained that the Allegro library uses internal instruments, which are set to the original Doom values in version 2.04. However, an external IBK file can override them:

Quote

Originally MBF used the Allegro build-in Midi-to-FM conversion table. The table is found in "Allegro\src\djgpp\fm_instr.h". When Allegro is build into its library form, this table is hardcoded in there. For the MBF 2.04 project I changed the fm_instr.h table to the Doom1 values.
For example the first line:
{ 0x00, 0x30, 0x14, 0x00, 0xf0, 0xf1, 0xf3, 0xf4, 0x01, 0x01, 0x0a, 0, 0, 0 }, // Acoustic Grand
Allegro already had the option to load another Midi-to-FM table, as an override, but only when it is in the IBK format, outside of a WAD.
MBF 2.04 uses this functionality for Doom2 mode, loading MBF_D2GM.IBK at startup.
Seemingly the Allegro sound driver should already support a user override through setup.cfg, as below. But I have not tested that.

setup.cfg
ibk_file =

I found some basic info on SBI and IBK formats at the ModdingWiki. Both are supported by Wohlstand's OPL3BankEditor, which I suppose can be used to create a new IBK for use with MBF from the default MBF_D2GM.IBK.

Share this post


Link to post

Or you could try and see if recent Tartar build do what you are after. After the whole discussion with @gerwin on the vogons forums Tartar has been made to actually load the instrument definitions from the WAD-s loaded, using the original Doom/DMX format. This is still via Allegro, so the "mileage may vary", but personally, I find that close enough.

 

EDIT: just to be clear, it would not load the "foreign" IBK format, but rather the original GENMIDI lump found in the IWAD/PWAD.

 

Edited by ludicrous_peridot

Share this post


Link to post
3 minutes ago, ludicrous_peridot said:

Tartar has been made to actually load the instrument definitions from the WAD-s loaded, using the original Doom/DMX format

That's very cool! I should check that out.

 

Meanwhile I quickly fired up the OPL3BankEditor and replaced the first 32 instruments in the MBF_D2GM.IBK with the SBI files found in the current Freed∞m repository (which I gather are the from the DMXOPL repo), and it worked -- I renamed the new bank file to DMXOPL3.IBK and put the line ibk_file = DMXOPL3.IBK in SETUP.CFG as gerwin suggested.

 

The only thing is that I haven't figured out why the Freed∞m source has two versions for most instruments. I guess this might be because DMXOPL has two builds for vanilla Doom and modern ports, but I'm not sure which is which, and which should be preferred for use with MBF.

Share this post


Link to post
2 minutes ago, SilverMiner said:

Ah, so this means I actually heard allegro's instruments in boom 2.02 on a real old pc

 

Unless that was an MBF 2.04 by @gerwin, yes that's pretty much surely were Allegro instruments. @gerwin did the heavy lifting of bringing his source port sound close enough to vanilla DMX spund, while still using allegro as the driver.

Share this post


Link to post

After some tedious mouse clicking I finally replaced all the instruments in MBF's IBK file with the ones from DMXOPL via the Freed∞m repo, but somehow everything sounds wrong, with instruments that should be loud sounding muted and vice versa. I'm not sure what's really wrong here, gotta do some more testing.

 

UPD: I figured out what's wrong, I needed to use the instruments that have the -2 suffix to sound right in MBF.

 

I also tried out other DMXOPL releases from the project GitHub repo, but although I was able to easily convert op2 banks to IBK, they sound very off in MBF, I'm not really sure why.

Edited by MrFlibble : removed the obsolete test IBK

Share this post


Link to post

Hehe... from what I found when I was fiddling with @gerwin's Allegro internals, IBK handling in Allegro did not match OP2 handling by LibMUS, which @gerwin himself pointed out to be a reference. So what I have done for Tartar was a customization that loaded OP2 lump directly and does not use IBK files at all. I have shared the modified Allegro lib and sources on vogons, maybe some day @gerwin accepts these to be part of the "upstream" version he maintains.

 

The changes are:

 

* support for loading of OP2 format files

* support for loading OP2 format instruments from memory buffer

* handling of instruments that define pitch offset in OP2 (not sure if IBK format has anything similar) - addresses wrong pitch as reported by @T-Squared

* Allegro fractional (sub-note) pitch bend no longer incorrectly applied with Adlib driver - addresses wrong band as reported by @T-Squared

* Instrument pan centered by default, as with Doom and LibMUS (was randomized by default with Allegro)

 

The source port was changed to check for GENMIDI lump at sound initialization, and pass it on to Allegro, if found.

 

If you are interested in running MBF specifically I could cook up a build of that with this tweaked version, and you could see if it sounds better with fresh FreeDoom banks, without the OP2 to IBK conversion hassle.

 

Myself, I did the straight conversion of Hexen GENMIDI to IBK once to improve how OPL music sounds in my Hexen port, but I like how the newest version that bypasses IBK sounds much more.

Share this post


Link to post
2 hours ago, ludicrous_peridot said:

I have shared the modified Allegro lib and sources on vogons

Is it this one?

2 hours ago, ludicrous_peridot said:

The source port was changed to check for GENMIDI lump at sound initialization, and pass it on to Allegro, if found.

How much code needs to be altered for this to work?

 

In the meantime, I figured that the OPL3BankEditor can actually load whole GENMIDI lumps if they have an op2 extension. This made testing much easier. However, it appears that GENMIDI actually contains more data than what IBK can include, as each instrument in IBK files only has Carrier 1 and Modulator 1 active fields, while GENMIDI.op2 also has Carrier 2 and Modulator 2 fields. I believe this is the reason why the music sounds off after the conversion.


UPD: I went back to DMXOPL v1.11, which is the latest to still only use Carrier 1 and Modulator 1, and quickly converted it to IBK with OPL3Bank Editor: DMXOPL11.zip. The result seems quite nice I believe, it does sound better than the default instrument settings in MBF IMO.

Edited by MrFlibble : added the DMXOPL11.IBK download

Share this post


Link to post

Yes, that one and not much work really.

 

Did this to MBF just now to check:

in I_Sound.c commented out IBK loading (although that's not really necessary; one can just rename the IBK file)

and added

void I_LoadSoundBanks(void * buf)
{
  // GB 2014
  // Allegro load_ibk: Reads in a .IBK patch set file, for use by the Adlib driver.
  // Returns non-zero on error. 
  // int load_ibk(char *filename, int drums)
  if (mus_card>0) 
  {
    if(load_op2(buf)==0) fputs(" - GENMIDI lump loaded", stdout);
    else                 fputs(" - failed to load GENMIDI lump", stdout); 
  }
}

 

in S_Sound.c added to S_Init()

  if (W_GetNumForName("GENMIDI") >= 0)
    {
      I_LoadSoundBanks(W_CacheLumpName("GENMIDI", PU_CACHE));
    }

 

Share this post


Link to post

All right, I did some more testing and determined that while there are some minor issues, OPL3BankEditor in its current state can properly convert melodic instruments from GENMIDI to the IBK format usable by BOOM and MBF. I have successfully converted DMXOPL 1.11 instruments to IBK, and it works as intended with both BOOM 2.02 and MBF 2.03 -- but, unfortunately, not MBF 2.04 at this moment (the cause of that yet to be determined).

 

I'm attaching both the melodic instrument IBK and the drums one, but I really don't recommend to use the drums, because there must've been some problem with converting percussion instruments in OPL3BankEditor. You can grab a generic DRUM.IBK supplied with SBTimbre or just leave the default Allegro percussion instruments without an IBK.

 

dmx_ibk.zip

Share this post


Link to post
On 11/12/2023 at 7:26 PM, ludicrous_peridot said:

Yes, that one and not much work really.

 

Did this to MBF just now to check:

in I_Sound.c commented out IBK loading (although that's not really necessary; one can just rename the IBK file)

and added

I've just compiled MBF with your binary and this code, everything seems to work fine. Downloadable here. Thanks again for sharing your library!

Share this post


Link to post

Okay, this is not strictly speaking IBK thing, but I wanted to raise awareness of (totally unauthorized) hacking of Allegro 3.0 to bring OPL sound *subjectively* closer to how original games sounded, using @gerwin's MBF 2.0.4 and its custom Allegro 3.0B as the starting point. 
For those interested in listening, a preview build of the engine (not MBF) is up on vogons that includes numerous tweaks like proper note offset support, better pitch bend handling and a take on "double-voice" polyphony (OPL3 would probably be a requirement for the latter, although Allegro supports double OPL2 configuration, but sadly I never tested this). It does not require IBK-s though.

UPDATE: and we also got an actual MBF build now, courtesy of @MrFlibble.

Edited by ludicrous_peridot : MBF build

Share this post


Link to post
On 11/30/2023 at 12:27 PM, ludicrous_peridot said:

we also got an actual MBF build now

I guess it won't hurt to upload it here as well: MBF_GENMIDI.7z

 

This is not a complete package, these are replacement EXEs for gerwin's MBF Maintenance release 2.04. The 7z archive includes all modified source files (compared to the latest source from gerwin), but please note that those from the Allegro package (in the Alleg30B folder) are for @ludicrous_peridot's version of Allegro found here.


Also here are some notes from @ludicrous_peridot about how secondary instruments support works in this build:

Quote

Also, to clarify - the secondary instruments support has been coded so that it's triggered only when
- OPL music is explicitly configured (don't think setting music card to -1 in allegro config will trigger it, even if allegro resolves this to, say, SB)
- Music is in MUS format
- GENMIDI lump was found and passed on to Allegro by the engine
...while most of this was in principle a deliberate choice on my part (e.g. not doing MIDI format), the whole thing is at the moment more of demo material, and the changes to liballegro are only limited to allow for that. (E.g. to the extent that providing OP2 to Allegro via filename as opposed to providing a "lump" would not result in secondary instruments kicking in).

Additionally, this build replaces Wolfenstein 3-D dogs with CC-BY versions created by @Nash:

3DEDezZ.pngxCpghKZ.png

I've not included the modified INFO.C file in the GENMIDI build package, but you can get it here.

Share this post


Link to post

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×