Making A Sound File For Duke3D  v9-18-2012 Release 1 RTCM Corvin

Introduction | Sound Specifications | Opening Anm | Adding to CONs | Sounds In Build | Echo Bug

Introduction

Note: This document was created several years before EDuke32 which now supports the higher quality snd type of OGG, in both the CON and DEF files. If you prefer to use OGG then see EDuke32.

 

Duke Nukem 3D has several definition types you may use in the game. One of these is defining new sounds you may use in your user created maps or game. All the sounds for Duke Nukem 3D are defined in the USER.CON file, however, you can put a definition in any of the CON files you like, as long as it is defined before you call it. See the USER.CON Document for all the details. 

Follow the steps below to totally incorporate your own sound into DN3D. If your looking to replace a midi/mid song, See the con-user-con Document. Also refer to it for the Sound table that describes existing game sounds.

Sound Specifications

The program expects to find and use any sound file that is :

  • A   .VOC file (Creative Sound Blaster) or  a .WAV file format (Windows).
  • Mono
  • 8-bit or 16-bit
  • unsigned or signed
  • PCM format (compression)
  • Any Sample Rate

Duke uses mono snd files(VOC or WAV) and "adds" stereo during the game. Duke will not playback stereo created snds. Most internal snd files are created and played back at a rate of 11025. This would be the sampling rate in your Sound Creation Tool. You can sample all the way upto 22050 on most systems, and the snds can be 8-bit or 16-bit mono, This is important: However the game likes straight foreword snd formats, so upon saving use a more common type of compression, like straight forward PCM. Duke will not playback complicated snd formats.

Remember that these snds won't play back at the quality you make them, unless your Duke setup is configured the same way. (I suggest editing the duke.cfg file to set Duke's Mixing rate precisely, See RTCMs related document.) For an example; If your snd is recorded at 11025 then you should set your duke.cfg file MixRate at 22050. Since the snds are mono and duke internally "adds" stereo spatial effects. The sound will playback at 11025 per speaker/channel. Thus a snd recorded at 22050 would require your duke mix rate to be 44100. It's preferable you don't sample snds higher than 11025 and duke mixrate at 22050, Unless of course the game performs smoothly on your system. High Mixrate can 'cause the game to freeze for a second or two, resulting in dropped frames.

You can add Effects to your snds... If you use any reverb or echo, try the snd under water to see how the game handles it 'cause the game adds its own pitch and reverb/echo combinations. If the sound performs poorly, remove or reduce the effects used. Also clean your snd files up, remove hiss and unwanted static, and clean the ends of the files so there's no pops. This will reduce the snd file size and provide better overall performance when played back in the Apogee Sound Engine.

Note: When sounds are played back in Duke they will sound slightly different then from your Sound editor or playback tools. The Apogee Sound Engine uses internal filters of its own. Don't forget to double check the sound playback.

Opening animation for Duke 3D

Making sounds for the opening intro screens have to match the animation screens. Record your sounds to last the entire length of the Startup screen per display. Note: Changing the Explosion sound will alter the sound within the game as well.

Sounds played(intro);

 244 FLY_BY - Startup sound (at nuke symbol)
 9 RPG_EXPLODE - A RPG rocket explodes (at nuke title)
 intro midi

Adding to CONs

Before we add your new sound files, you should move them to the games directory.   Once you've done this, read RTCMs USER.CON Document, the section to look for is 'definesound'

Using Sounds In Build
  • To make a player hear a snd when he walks on a sector floor apply a sector Lo-tag of 10000 + the sound number.
  • To make the sound an ambient or background sound add a sector effector with a Hi-tag of the sound number at the location where the sound will originate from in the game. The Lo-tag is then the maximum distance the sound can be heard: 1024 = 1 square (largest grid). The further you're away from the sound, the softer the sound will be.
  • Settings in Build will override the variables in the user.con.
    Note: Sound statements(Game.Con) are not EXECUTED if a player is more than 32768 units away from the source. (not true global)

Echo/Reverb Crash - PCI Bug

Note: The following is info related to playing the DOS game in DOS or a WinDOS-Box with newer PCI cards. This does not pertain to the new third party emulator DOSBox.

 

Newer PCI snd cards tend to crash most build games, if not all. This may occur in map sectors where the Echo(reverb) settings are switched on Such as water, sewers, subways etc... ).
This error occurs on such cards as SoundBlaster Live, Creative Labs SB or Ensoniq PCI Audio Cards, and cards with the ESxxxx(Software) and ESS(hardware FM synthesis (ESFM)) chip sets. typically most PCI Sound('98-'02+) cards suffer this flaw. The reason behind this is that the PCI Sound Cards and there drivers are emulated(virtual) to act as if they are ISA DOS Standard.
See RTCM's Build Games in Windows Doc for ISA Legacy Knowledge.

Test:

To test your Game/Soundcard, first determine that your game runs and operates without any-errors. Next load and try to enter E1L4(the start of the level puts you directly in a nice "Ensoniq Bug" fallout) If the game crashes or freezes...this Bug may be your problem. Make sure you have the CD in the drive, so you don't mistake the normal "Put CD in Drive" game dropout with the Sound crash.

Basic Help:

  • Playing in pure DOS tends to elevate this problem for some not many.
  • If that doesn't work try updating your drivers/soundcard software, or degrading to previous versions, maybe even back to win3.11 drivers.
  • Some users simply suggest removing the tagged sectors(duke) of a map to remove the reverb effect. (Echo effector is as follows: the sprite is MUSICANDSFX (no. 5) with the lotag set to a range of 1000 to 1255 inclusive, any sprites with these settings should be removed to prevent the crash), Keep in mind this takes away from the games atmosphere and is not ideal. I personally advise the Map Builder to continue to use the Echo(reverb) tag and the patch/workaround(see below)  together until such a fix is discovered.
  • 3DRealms is aware of the problem, they have no fix for this problem, and "will not have one." The problem can be corrected via the src code for the Apogee Snd engine or from your OS or Snd Card developers. Contact your soundcard manufacture and Microsoft to ask if they can help to resolve this issue. Explain to them that the game was designed for ISA Cards, and there is a bug in Windows and or the sound card drivers.

Workaround:

Ken Silverman has released an Echo Snd patch/workaround for Duke3D and a couple of other BUILD Games, It patches the game.exe to switch off Echo playback. However Reverb through out the game is also switched off as a result. Download The patch from his Build Site