Soundscape: Difference between revisions
ThaiGrocer (talk | contribs) m (→See also) |
|||
Line 178: | Line 178: | ||
* [[List of TF2 Soundscapes]] | * [[List of TF2 Soundscapes]] | ||
* [[List of Portal soundscapes]] | * [[List of Portal soundscapes]] | ||
* [[List of L4D Soundscapes]] | |||
[[Category:Sound System]] | [[Category:Sound System]] | ||
[[Category:Level Design]] | [[Category:Level Design]] |
Revision as of 08:57, 3 June 2009
Soundscapes are audio scripts that create background ambience in maps. Sound clips can be looped or played randomly, and can be emitted evenly or from specific locations. A soundscape can also enforce DSP and Soundmixer profiles.
A soundscape can be used in any number of maps, requires only a single entity to implement, and does not generate any network traffic. However, the sounds it plays cannot be precisely controlled and only one soundscape can be active at any given time.
Soundscapes will crossfade between each other over a default of three seconds. Configure this from the console with soundscape_fadetime
.
Implementing
env_soundscape
Soundscapes are generally implemented with env_soundscape. Its keyvalues, inputs etc. should be self-explanatory.
The active env_soundscape is the one that the player:
- Has direct line of sight to
- Is in range of
- Is closest to (in case of a tie)
When an env_soundscape ceases to be active, the soundscape it began persists until another one is begun or the map changes.

soundscape_debug
examine which entity is active and why.trigger_soundscape
The other method is trigger_soundscape. The associated env_soundscape_triggerable will be played when the player is inside the trigger volume.

Finding a soundscape
Hammer doesn't list available soundscapes. The best way of finding one is loading up a map and using the concommand playsoundscape
(which does know what's available and will autocomplete while you type) to start one up.
Creating
Example
Soundscapes work like this:
<name> { <rule> { <keyvalue> ... } ... }
All must be stored in text files listed by game\scripts\soundscapes_manifest.txt
. Each must have a globally unique name.

scripts\soundscapes_<map name no extension>.txt
to use new soundscapes without modifying the manifest.Common keyvalues
wave <string>
- The path and filename of the sound to play, relative to
game\sound\
. volume <normal>
- 1 is full power, 0 is silent.
pitch <integer>
- Percentage value. +/-30 is the useful range.
position <0-7>
- One of eight locations in the world (defined by the mapper) from which a sound can be emitted.
position random
- As above, but the sound emits from a completely random location near the player.
attenuation <float>
- How quickly the sound's volume drops as the camera moves away from it. Only relevant with a
position
specified.Todo: What are the rules? soundlevel <string>
- Can be used instead of
attenuation
. Accepts one of the engine's pre-set values.

Randomised values
Some rules accept 'upper' and 'lower' parameter values. For example:
pitch 80,120
Whenever the rule is executed the value will be randomly selected within the given range.
Rules
playlooping
Plays a sound constantly. Does not allow random values.

playrandom
Plays a sound after given number of seconds. Allows random values.
Playrandom requires all wave
KVs to be inside rndwave
(even if there is only one). A random selection will be made every time the rule is executed.
playrandom { time 1,4 volume 0.4,1 pitch 90,105 rndwave { wave ambient/wind/wind_med1.wav wave ambient/wind/wind_hit1.wav } }
playsoundscape
Plays a complete soundscape. DSP presets in the 'sub-scape' are ignored.
name
- Name of the soundscape to play.
position <int>
- Offsets each position index of the sub-scape. Todo: What does that mean?
positionoverride <int>
- Forces all positioned sounds in the sub-scape to emit from one location.
ambientpositionoverride <int>
- Forces all unpositioned (i.e. ambient) sounds in the sub-scape to emit from one location.
SubScape { playsoundscape { name GenericIndoor // Overall sub-scape volume to 50% volume 0.5 // Emit all positioned sounds from position 0 positionoverride 0 // Emit all ambient sounds from position 1 ambientpositionoverride 1 } }
dsp
Overrides the current DSP preset (which would otherwise be derived from the $surfaceprop of nearby materials).
For a list of values, open scripts\dsp_presets.txt
. You may need to extract this from the relevant engine GCF with GCFScape. To preview a DSP preset, submit room_type <int>
to the console.

// Disable DSP and play no ambient sounds Empty { dsp 0 }
soundmixer
Selects a custom soundmixer. Soundmixers manage the priority and volume of groups of sounds; create new ones in scripts\soundmixers.txt
(ALWAYS use Default_Mix as a template).
quiet { soundmixer Citadel_Dialog_Only ... }