Sounds: Background and Local

From The DarkMod Wiki
Jump to navigationJump to search

written by Fidcal

Introduction

All that is assumed is you know the essentials described in Dark Radiant Must Know Basic Intro

If you want a global ambient sound heard throughout your mission then also read Adding ambient Sounds to your Map.

This tutorial covers general background sounds, local ambience, environmental, or sounds related to specific objects in the game such as a machine or a drain.


Sound File Types

OGG and WAV files are used in Dark Mod. For details see Sound File Formats

OGG files are compressed whereas WAV files do not compress well even in zip files (so I'm told!)

You can create your own sounds but there is already a large range provided in Dark Mod ready to use.

Those sound files can be referenced either directly (with full path and name) or via a definition file called a sound shader which can include various controls as well as the name of the sound file and path. Multiple sound file definitions can be included in one sound shader file. Other controls are available as properties in the speaker entity in the map file. These properties will override the equivalent definition in the sound shader.


Speaker Entity

The speaker entity is like a loudspeaker that you place in your mission.

To include a sound in your mission...

  • create a speaker entity and position it where you want the sound to be centred.
  • Add the property s_shader
  • In Dark Radiant you can select a sound shader from the button below the entity properties.


Properties of the Speaker Entity

The following are properties to add to the speaker entity to adjust the way it plays sounds. There is no need to dmap between adjustments of these properties. Assuming you have dmapped once you can just use map to test changes.

Before proceeding, it's worth quoting Orbweaver:

  1. If a speaker is looping, it will play all the time, but will obviously only be audible when the player is within range.
  2. If a speaker is non-looping but waits for trigger, then it will do nothing until triggered. Once triggered it will play but will only be audible if the player is within range.
  3. If a speaker is non-looping and untriggered, it will play once at startup, irrespective of whether the player is near enough to hear it.


Loudness, Volume

s_volume N = loudness - depends on how loud the original sound file is, what effect you want, and how far you want it to reach (if fade is set, see #Range, Radius, Distance covered by Sound. Typical values might be in the range from -20 up to +20 or +30 but it may be a matter of trial and error.


Direction of Source, Propogation through Doorways

s_occlusion 1 makes the sound go in a straight line and not through visportalled gaps like doorways etc. If set to 0 then it follows a natural route through openings.

s_omni 1 makes the sound come from no particular direction so this is ideal for ambience like rainfall or mood music (unless that music is meant to come from something in the game.) Set s_omni to 0 if you want your sound to sound like it is coming from the speaker entity.



Range, Radius, Distance covered by Sound

The units used for the distance reached by the speaker entity are in [i]metres[/i] not Doom units so these approximate 40 normal units. In DoomEd the radius is shown in the grid view and this feature is also being added to Dark Radiant.

  • s_mindistance N = distance in metres from speaker at which sound starts to fade. Within that radius it is at full volume.
  • s_maxdistance N = distance in metres from speaker beyond which it cannot be heard at all.


Playing a Sound Once

By default, if no looping or repeat is set up then a speaker will play once at mission start then stop. But unless the player is within range it will not be heard.

So to play a sound once when the player approaches you need a separate trigger (see #Triggering a Sound)

Repeating a Sound Continuously

s_looping

s_looping repeats a sound seamlessly and is the one to use for continuous sound like rain, continuous machinery, etc. (compare also wait before using this.

s_looping set to 1 means...

  1. Play sound immediately the player is within range (set by s_maxdistance)
  2. Wait until the sound has finished playing
  3. Repeat endlessly unless the player moves out of range (set by s_maxdistance)

Set s_looping to 0 to disable (default)


Screen Shaking, Explosions, etc.

s_shakes set to 1 makes the screen shake when the sound is loud. Suitable for explosions, earthquakes.


Sound Shader Definition Files

This to be written. It might need a separate article in which case adjust the link above. Meanwhile here is an external link...

http://www.iddevnet.com/doom3/sounds.php