VOGONS


First post, by ZipoBibrok

User metadata
Rank Newbie
Rank
Newbie

I might have somehow managed to modify Duke Nukem 3D AWE32 driver to load custom soundfont to AWE32 under DOS. New version of PAWE32.LIB that supports SF2 seems to break sound effects (mixing?) code, don't know why yet.

Video with some level skipping to different songs:
https://www.youtube.com/watch?v=KODFV7jJIz0

If you have 8MB RAM on your AWE32, you can try putting DUKE3D.EXE and DUKE3D.SF2 from this archive to your Duke Nukem 3D (1.4/1.5) directory, set Music card to AWE32 and Sound FX card to None (will otherwise freeze at intro) and if you're very lucky the music might now sound a little different. Probably won't work under Windows, if at all. I have absolutely no idea what I'm doing and I'm not responsible if this somehow makes your computer crash, wipe your hard drive and explode killing everyone in 100km radius.

The soundfont is based on Chaos V2.0 12MB with unused instruments removed and replaced with ROM ones, by sheer luck reducing the size to just barely fit in 8MB of RAM. Soundfont version tag has to be 2.00, library refuses to load 2.01 or over (changing it with hex editor seems to be enough). Also if there are too many instruments/drum kits it will crash.

Butchered audiolib source code as attachment. Basically just copypasted soundfont loading stuff from DEMO.C in AWE developer pack adding some useless debug printf's and replaced old CTAWEAPI.H and PAWE32.LIB files with newer ones from adip.exe.

Reply 1 of 9, by kolderman

User metadata
Rank l33t
Rank
l33t

> Music card to AWE32

I thought this mode just used onboard samples, and its only via the mpu401 emulation can you take advantage of soundbanks/fonts. Or am I missing something here!

Reply 2 of 9, by ZipoBibrok

User metadata
Rank Newbie
Rank
Newbie
kolderman wrote:

> Music card to AWE32

I thought this mode just used onboard samples, and its only via the mpu401 emulation can you take advantage of soundbanks/fonts. Or am I missing something here!

I modified the AWE32 driver code to load the soundfont as I described.

Reply 3 of 9, by kolderman

User metadata
Rank l33t
Rank
l33t

Yes but my question is does awe32 mode *use* the soundfont? I load a soundfont under windows when it boots up....but if I select awe32 sound it won't make use of it, I need to select midi. Are you actually changing the way the driver talks to the emu8k so it synthesizes from the ram?

Reply 4 of 9, by ZipoBibrok

User metadata
Rank Newbie
Rank
Newbie
kolderman wrote:

Are you actually changing the way the driver talks to the emu8k so it synthesizes from the ram?

Yes. AWE32 driver in Apogee Sound System used in Duke 3D is based on Creative's DOS library that has always had functions for loading soundfonts, but nobody ever bothered to use them back in the day. By default it uses instrument definitions embedded in the library. I just copied and added the soundfont loading code from the demo and rebuilt the executable. It now loads file named duke3d.sf2 located in same directory as the executable is. It probably won't work under Windows as the library talks directly to EMU8000 and has it's own midi engine code.

Reply 7 of 9, by kolderman

User metadata
Rank l33t
Rank
l33t

How many other games can this be extended to? Can I drop in any sf2?

Reply 8 of 9, by ZipoBibrok

User metadata
Rank Newbie
Rank
Newbie
kolderman wrote:

How many other games can this be extended to?

Rise of the Triad and Shadow Warrior at least.

kolderman wrote:

Can I drop in any sf2?

Soundfont version tag has to be 2.00, it refuses to load 2.01 or over (changing it with hex editor seems to be enough). Also if there are too many instruments/drum kits (not sure about the number) it will crash. It's best to remove unused instruments for loading time's sake.

Reply 9 of 9, by ZipoBibrok

User metadata
Rank Newbie
Rank
Newbie

Someone with enough skills could probably reverse-engineer how drivers in audio libraries with external drivers (HMI, Miles and some others) work and cobble together new ones and that then would cover majority of DOS games with MIDI music.