VOGONS


Duke Nukem 2 ADPCM fix?

Topic actions

Reply 20 of 36, by keropi

User metadata
Rank l33t++
Rank
l33t++

Just tried it on my 386DX/SW-20PC combo... I cannot detect anything different with the extra files or not... explosions and fire sounds are missing for example. I get these on my 233mmx/SB16 build though.

🎵 🎧 PCMIDI MPU , OrpheusII , Action Rewind , Megacard and 🎶GoldLib soundcard website

Reply 21 of 36, by simbin

User metadata
Rank Member
Rank
Member

I tried it on my SB Live! with SB16 emulation and it doesn't seem to work.

WIP: 486DX2/66, 16MB FastPage RAM, TsengLabs ET4000 VLB
Check out my Retro-Ghetto build (2016 Update) 😀
Commodore 128D, iBook G3 "Clamshell"
3DO M2, Genesis, Saturn, Dreamcast, NES, SNES, N64, GBC

Reply 22 of 36, by Cyberdyne

User metadata
Rank Oldbie
Rank
Oldbie

I used CAMOTO to replace all soundfiles inside NUKEM2.CMP, with this archive I made, and all works just fine, and OPL-SAx missing sounds problem is gone. NB! It does not help with other problems, only ADPCM 2-to-8 or 3-to-8 impared sound cards.

Download this:
www.vogons.org/download/file.php?id=26847

Install this:
http://www.shikadi.net/moddingwiki/Camoto

I am aroused about any X86 motherboard that has full functional ISA slot. I think i have problem. Not really into that original (Turbo) XT,286,386 and CGA/EGA stuff. So just a DOS nut.

Reply 24 of 36, by Cyberdyne

User metadata
Rank Oldbie
Rank
Oldbie

Strange, I converted and replaced the sound files, but something i am missing, maybe the duke executable knows what files are what format and ignores the headers of sound files... it is only plausable explanation.

I am aroused about any X86 motherboard that has full functional ISA slot. I think i have problem. Not really into that original (Turbo) XT,286,386 and CGA/EGA stuff. So just a DOS nut.

Reply 25 of 36, by K1n9_Duk3

User metadata
Rank Member
Rank
Member

I know a bit about Duke Nukem 2, so if you have any questions regarding its codebase, feel free to ask. Here are some things I wanted to share:

- @Cyberdyne: The files in your archive still use ADPCM. You probably uploaded the wrong files.
Edit: I just noticed that some files were indeed converted, but SB_2.MNI, SB_20.MNI and SB_21.MNI still use compression types 2 and 3 (2.6 bits and 2 bits ADPCM).

- You don't need Camato (unless you want to extract the original VOC files from NUKEM2.CMP yourself). Just put the replacement SB_*.MNI files in your Duke Nukem 2 folder and the game will use the external files instead of the ones included in NUKEM2.CMP. This applies to both the shareware release and the registered version of the game.

- Duke Nukem 2 does not make any assumptions on the format or the structure of individual VOC files. It reads the entire file (modulo 65536 bytes) into memory and passes all the data to the playback routines.

- The sound effects for the intro animation weren't mentioned anywhere in this thread. The sound files for that are INTRO3.MNI to INTRO9.MNI.
Edit: These files use compression types 0 and 1, so maybe they don't need to be converted after all.

- ADPCM was used to decrease the size of the digitized sounds. Using uncompressed versions of the VOC files will likely cause the game to run out of memory and crash. Duke Nukem 2 allocates a big buffer of 390,000 bytes at startup and uses that buffer to store all game data (level, sounds, music, graphics etc.). Even if your computer has more memory available, Duke2 will only use this fixed amount. Some levels use up a lot of memory, to the point where using up just a few more bytes would cause a crash. If you don't believe me, play episode 2 level 2 on the hardest difficulty setting and press H to bring up the help screen or hold down N-U-K to use the weapons/inventory cheat. The game will quit to DOS with an invisible "No Memory" error.

- Major Stryker uses the same digitized sound playback routines as Duke Nukem 2. IIRC every single VOC file in Major Stryker uses ADPCM. Monster Bash also uses ADPCM for most/all its VOC files, but the playback routines are not the same as in Duke Nukem 2.
Edit: If only the compression types 2 and 3 (2.6 bis and 2 bits ADPCM) are unsupported by those clone cards, then I'll have to take a look at every single VOC file in these games. The ones I've tested so far all use compression type 1 (4 bits ADPCM).

- Duke Nukem 2 parses the BLASTER environment variable to get the Address, IRQ and DMA values. There are error messages for unsuported settings in the sound blaster code, but Duke Nukem 2 does not show any of these. Supported address values are 0x210, 0x220, 0x230, 0x240, 0x250 and 0x260. Supported IRQ values are 2, 3, 5, 7 and 10. Supported DMA channels are 0, 1 and 3.

Reply 26 of 36, by kode54

User metadata
Rank Member
Rank
Member

The Last Eichhof also uses ADPCM 2 and/or 2.6 samples. It was my main inspiration in tracking down a piece of software which could work with those formats.

The software I found was the totally original name Blaster Master. It contains compression and decompression routines for 2, 2.6, and 4 bit VOC ADPCM. It's a limited shareware version, so it can only save files up to 10 seconds in length, and it imposes a 10 second delay at startup and shutdown to make you read the shareware notice. The code from this editor was disassembled and converted to C for my contribution to Dosbox.

Reply 27 of 36, by Cyberdyne

User metadata
Rank Oldbie
Rank
Oldbie

Thanx, that really helped, now all is to do is to convert everything to 4bit adpcm, and start beta testing the game.

Last edited by Cyberdyne on 2021-02-08, 06:25. Edited 1 time in total.

I am aroused about any X86 motherboard that has full functional ISA slot. I think i have problem. Not really into that original (Turbo) XT,286,386 and CGA/EGA stuff. So just a DOS nut.

Reply 31 of 36, by K1n9_Duk3

User metadata
Rank Member
Rank
Member
keropi wrote:

did this ever lead to a definite fix for the game?

You tell me:

Filename
DUKE2VOC.zip
File size
94.23 KiB
Downloads
288 downloads
File license
Fair use/fair dealing exception

This archive contains two sub-folders: 4BITVOC and 8BITVOC. The 4BITVOC folder contains the sounds that were originally using 2-bit and 2.6-bit ADPCM. As the name suggests, the files were re-encoded as 4-bit ADPCM, which is the same format as most of the other sound files in Duke Nukem 2. The 8BITVOC folder contains all sounds that were originally using any kind of ADPCM, re-encoded as standard 8-bit PCM sounds.

To use the sounds, simply copy the files you want to use into your game folder. To remove the modified sounds, just delete all *.MNI files in the game folder.

I'm not sure if the 4-bit files will actually make any difference at all since I don't have a sound card with crippled ADPCM support. All I can say is that the 4-bit sounds don't work when running the game natively in Windows XP, but the 8-bit sounds do play (with some issues during the intro). Both versions work fine in DOSBox.

The biggest problem is that the size of the new sound files is 2-4 times the size of the original files, which means the game crashes all the time because it is running out of memory. You can try modifying the executable with this patch script (and this patching utility) to make more memory available, but if your system doesn't have enough free conventional memory, then this obviously won't help. The new sound files are around 35 kb bigger than the original ones, so you'll need around 595 kb of free conventional memory to play the game with these sounds.

Reply 33 of 36, by keropi

User metadata
Rank l33t++
Rank
l33t++
K1n9_Duk3 wrote:
You tell me: […]
Show full quote
keropi wrote:

did this ever lead to a definite fix for the game?

You tell me:

DUKE2VOC.zip

This archive contains two sub-folders: 4BITVOC and 8BITVOC. The 4BITVOC folder contains the sounds that were originally using 2-bit and 2.6-bit ADPCM. As the name suggests, the files were re-encoded as 4-bit ADPCM, which is the same format as most of the other sound files in Duke Nukem 2. The 8BITVOC folder contains all sounds that were originally using any kind of ADPCM, re-encoded as standard 8-bit PCM sounds.

To use the sounds, simply copy the files you want to use into your game folder. To remove the modified sounds, just delete all *.MNI files in the game folder.

I'm not sure if the 4-bit files will actually make any difference at all since I don't have a sound card with crippled ADPCM support. All I can say is that the 4-bit sounds don't work when running the game natively in Windows XP, but the 8-bit sounds do play (with some issues during the intro). Both versions work fine in DOSBox.

The biggest problem is that the size of the new sound files is 2-4 times the size of the original files, which means the game crashes all the time because it is running out of memory. You can try modifying the executable with this patch script (and this patching utility) to make more memory available, but if your system doesn't have enough free conventional memory, then this obviously won't help. The new sound files are around 35 kb bigger than the original ones, so you'll need around 595 kb of free conventional memory to play the game with these sounds.

awesome awesome once again a great patch! I will test later when I have some free time, thanks a bunch!!!

🎵 🎧 PCMIDI MPU , OrpheusII , Action Rewind , Megacard and 🎶GoldLib soundcard website

Reply 34 of 36, by Fusion

User metadata
Rank Member
Rank
Member

http://www.shikadi.net/moddingwiki/Camoto

^ Woo... looing forward to trying out this editor. Anyone had any luck creating content with it?

Pentium III @ 1.28Ghz - Intel SE440xBX-2 - 384MB PC100 - ATi Radeon DDR 64MB @ 200/186 - SB Live! 5.1 - Windows ME

Reply 35 of 36, by Cyberdyne

User metadata
Rank Oldbie
Rank
Oldbie

For the OPL-SAx you only need to change the 4bit voc files. And usually do not even need to patch the EXE file.

But I have a new problem with few computers with OPL-SA3. The game starts and few seconds to few minutes in the gameplay, sounds work, and then silence from the digitized part, only Adlib sounds, I even tried to disable CPU Cache to slow things down, but even that did not help, maybe someone else had the same problems. Maybe even with some other sound card. Maybe even had a solution.

Only thing to restore sounds, is to restart the full game, and then also only ingame sounds are heard under a minute. then silence again. Tried the original OPL-SAx and Tiido setting program.

I am aroused about any X86 motherboard that has full functional ISA slot. I think i have problem. Not really into that original (Turbo) XT,286,386 and CGA/EGA stuff. So just a DOS nut.

Reply 36 of 36, by K1n9_Duk3

User metadata
Rank Member
Rank
Member

If the soundblaster sounds stop working after a while, it usually indicates an IRQ problem. The first thing to check is if your BLASTER variable exists and is actually correct. Duke Nukem II defaults to IRQ 7 if the BLASTER string hasn't been set or the BLASTER string doesn't include an IRQ value. Just enter "set" at the DOS prompt and it should list all of your environment variables, including the BLASTER string.

It's also possible that there is a bug somewhere in the soundblaster code of that game. For example, the sound could be so short that it finishes before the remaining code was able to set the "sound is playing" variable, leading the code to believe that sound is still playing when it really isn't. The sound routines clear the "sound is playing" variable when the sound ends, but if there's no sound active anymore, it can't get cleared. If the game thinks that it's playing a sound with a high proirity, it won't even try to play any digitized sounds with a lower priority. But the game forces all sounds to stop when you quit to the main menu, so if that doesn't fix it then the problem must be caused by something else.