Sounds: Background and Local: Difference between revisions
New page: ''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 thro... |
|||
Line 34: | Line 34: | ||
== Properties of the Speaker Entity == | == 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 | 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: | |||
# If a speaker is looping, it will play all the time, but will obviously only be audible when the player is within range. | |||
# 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. | |||
# 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. | |||
== Triggering the Sound == | == Triggering the Sound == |
Revision as of 19:40, 12 November 2007
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:
- If a speaker is looping, it will play all the time, but will obviously only be audible when the player is within range.
- 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.
- 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.
Triggering the Sound
Speakers trigger when the player is in the vicinity - that is, within the radius set by s_maxdistance (see #Loudness, Volume
If s_waitfortrigger is set to 1 then the speaker is disabled until triggered by a switch of some sort. Default is 0.
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.
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...
- Play sound immediately the player is within range (set by s_maxdistance)
- Wait until the sound has finished playing
- Repeat endlessly unless the player moves out of range (set by s_maxdistance)
Set s_looping to 0 to disable (default)
wait (repeat)
wait n means repeat every n seconds endlessly so is the one to use to repeat with a gap between plays of the sound. Do NOT use it with s_looping set to 1 because 'wait' repeats on its own and s_looping will override it and repeat immediately and endlessly.
wait n means...
- Play sound immediately the player is within range (set by s_maxdistance)
- Wait n seconds from START of playing sound
- Repeat endlessly unless the player moves out of range (set by s_maxdistance)
What if n is shorter than the length of the wav or ogg file? It cuts the sound short and starts again. Here's an example of what happens If, eg, you play a bell sound that is 6 seconds long (the original ogg or wav file) and if you set wait 1 then it will...
- start to play the sound
- plays it for 1 second
- will not complete that but...
- begin again at the start every 1 second.
Use with random to vary the wait time...
random
Use with the wait property to vary the repeat time. random n varies the wait time randomly by plus or minus n seconds. So for example...
- wait 30
- random 10
...will play the sound repeatedly between 20 to 40 seconds from the start of playing the sound.
If random is greater than wait then it works the same but with a minimum of zero, so....
- wait 10
- random 15
... will play the sound repeatedly between 0 and 25 seconds from the start of playing the sound.
he sound no directional source, ie, it will not seem to come from the direction of the speaker but from all directions.
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...