Sounds: Background and Local: Difference between revisions
m →Sound Shader Definition Files: fixed link |
|||
(15 intermediate revisions by 5 users not shown) | |||
Line 46: | Line 46: | ||
== Loudness, Volume == | == Loudness, Volume == | ||
s_volume | The '''s_volume''' property allows you to change the volume of a sound. It specifies the change to the volume of the audio file, in decibels, and may be positive or negative. | ||
Be careful about making sounds too loud with this keyvalue, decibels are fairly "small" units and setting a volume increase of +20dB may well make the sound too loud for players. Ambient sounds should be at a similar volume throughout the map, and should not be so loud as to obliterate important gameplay sounds such as footsteps, or cause the player to reach for their volume control every time they enter a new area. | |||
== Control of volume by 'Ambient Volume' menu setting == | |||
If you want to give the player user-friendly control over the sound volume (as with ambient music, which some players prefer off), include the keypair "s_music" "1" on the speaker entity. | |||
== Direction of Source, Propogation through Doorways== | == Direction of Source, Propogation through Doorways== | ||
Line 61: | Line 65: | ||
== Range, Radius, Distance covered by Sound == | == Range, Radius, Distance covered by Sound == | ||
The units used for the distance reached by the speaker entity are in | The units used for the distance reached by the speaker entity are in ''metres'', not Doom units, so these approximate 40 normal units. There are two concentric ranges: | ||
* s_mindistance N = distance in metres from speaker at which sound starts to fade. Within that radius it is at full volume. | * 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. | * s_maxdistance N = distance in metres from speaker beyond which it cannot be heard at all. | ||
When the speaker-visualization button is on, each speaker's two ranges are shown: as circles (in grid view, with radii); and as spheres (in camera view). | |||
==Triggering a Sound== | |||
Speakers by default will start to play at mission start even if the player is not in range to hear them. But speakers can be set to wait for a trigger - so any switch, button or other trigger can start and stop them. To do this, set the property s_waitfortrigger to 1 then the speaker is disabled until triggered by a switch of some sort. Default is 0. | |||
Line 72: | Line 82: | ||
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. | 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]]) | So to play a sound once when the player approaches you need a separate vicinity trigger (see also [[#Triggering a Sound]]) that triggers only once. This is how... | ||
* Create and place your speaker and give it the property ''s_waitfortrigger'' with a value of 1 | |||
* At the place where you want the player to trigger the sound create a brush with a volume suitable for the trap so the player will pass into it. | |||
* With the brush selected, assign it (create) an entity ''trigger_once'' | |||
* The brush automatically gets a ''trigger'' texture which is invisible in-game. | |||
* Add the property ''target'' with the value being the name of your speaker. | |||
When the player moves into that invisible brush it should trigger the speaker to play its sound once only. | |||
== Repeating a Sound Continuously == | == Repeating a Sound Continuously == | ||
Line 88: | Line 106: | ||
Set s_looping to 0 to disable (default) | Set s_looping to 0 to disable (default) | ||
=== wait (repeat) === | === wait (repeat) === | ||
Line 102: | Line 119: | ||
# Repeat endlessly unless the player moves out of range (set by s_maxdistance) | # 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? | What if n is shorter than the length of the wav or ogg file? If there is only a single sound in the sound shader file then 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 | # start to play the sound | ||
Line 108: | Line 125: | ||
# will not complete that but... | # will not complete that but... | ||
# begin again at the start every 1 second. | # begin again at the start every 1 second. | ||
However, if there are multiple sounds in the sound shader file which are selected randomly then they one will be played every N seconds and they will overlap unless it happens to call the same one twice in a row (which can be prevented with nodupes in the sound shader file.) | |||
Use with random to vary the wait time... | Use with random to vary the wait time... | ||
=== random === | === random === | ||
Line 129: | Line 147: | ||
he sound no directional source, ie, it will not seem to come from the direction of the speaker but from all directions. | 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. == | == Screen Shaking, Explosions, etc. == | ||
s_shakes set to 1 makes the screen shake when the sound is loud. Suitable for explosions, earthquakes. | s_shakes set to 1 makes the screen shake when the sound is loud. Suitable for explosions, earthquakes. | ||
Line 140: | Line 158: | ||
This to be written. It might need a separate article in which case adjust the link above. Meanwhile here is an external link... | This to be written. It might need a separate article in which case adjust the link above. Meanwhile here is an external link... | ||
https://iddevnet.dhewm3.org/doom3/sounds.html | |||
[[Setting Up Speakers]] aims to cover shaders as well.<br> | |||
(apologies for the overlap btw., plasticman) | |||
[[Category:Sound]] | [[Category:Sound]] | ||
[[Category:Editing]] | [[Category:Editing]] |
Latest revision as of 12:45, 22 January 2024
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.
Loudness, Volume
The s_volume property allows you to change the volume of a sound. It specifies the change to the volume of the audio file, in decibels, and may be positive or negative.
Be careful about making sounds too loud with this keyvalue, decibels are fairly "small" units and setting a volume increase of +20dB may well make the sound too loud for players. Ambient sounds should be at a similar volume throughout the map, and should not be so loud as to obliterate important gameplay sounds such as footsteps, or cause the player to reach for their volume control every time they enter a new area.
If you want to give the player user-friendly control over the sound volume (as with ambient music, which some players prefer off), include the keypair "s_music" "1" on the speaker entity.
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 metres, not Doom units, so these approximate 40 normal units. There are two concentric ranges:
- 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.
When the speaker-visualization button is on, each speaker's two ranges are shown: as circles (in grid view, with radii); and as spheres (in camera view).
Triggering a Sound
Speakers by default will start to play at mission start even if the player is not in range to hear them. But speakers can be set to wait for a trigger - so any switch, button or other trigger can start and stop them. To do this, set the property s_waitfortrigger to 1 then the speaker is disabled until triggered by a switch of some sort. Default is 0.
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 vicinity trigger (see also #Triggering a Sound) that triggers only once. This is how...
- Create and place your speaker and give it the property s_waitfortrigger with a value of 1
- At the place where you want the player to trigger the sound create a brush with a volume suitable for the trap so the player will pass into it.
- With the brush selected, assign it (create) an entity trigger_once
- The brush automatically gets a trigger texture which is invisible in-game.
- Add the property target with the value being the name of your speaker.
When the player moves into that invisible brush it should trigger the speaker to play its sound once only.
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? If there is only a single sound in the sound shader file then 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.
However, if there are multiple sounds in the sound shader file which are selected randomly then they one will be played every N seconds and they will overlap unless it happens to call the same one twice in a row (which can be prevented with nodupes in the sound shader file.)
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...
https://iddevnet.dhewm3.org/doom3/sounds.html
Setting Up Speakers aims to cover shaders as well.
(apologies for the overlap btw., plasticman)