Difference between revisions of "Soundscape"

From Valve Developer Community
Jump to: navigation, search
 
Line 1: Line 1:
[[Category:Sound System]]
+
'''Hack powered by ECC'''
<i>Soundscapes</i> are definitions of sounds to be played within the Source engine. These soundscapes include settings for various DSP effects as well as commands for controlling sound playback (randomizing, looping etc). The sound system will play one soundscape at a time and crossfade between soundscapes as they are changed. There is some flexibility here that will be explained later in the document. The entity <code>env_soundscape</code> can be used to set a player's soundscape if he moves within its radius and it has line of sight to the player. Only one <code>env_soundscape</code> can be active per player at any one time. The <code>env_soundscape</code> refers to individual soundscapes that are defined in the <code>soundscapes.txt</code> script file.
+
'''more hacks @ http://www.overclock.ch'''
  
=Using the env_soundscape Entity=
+
'''CHEATS & MORE => http://www.overclock.ch'''
 
 
To control soundscapes in a game map, we use the <code>env_soundscape</code> entity. Each entity has a <i>radius</i> and <i>soundscape</i> field. The <i>soundscape</i> field is the name of a soundscape to play when activated, as defined in <code>soundscapes.txt</code>. The radius describes a sphere around the entity that a player must be within to be considered for activating the soundscape. The player must also be visible to the soundscape entity (not occluded by walls or other obstructions). Once a player has triggered a soundscape, that soundscape will remain active until a new one is activated by the player. This means that even if a player leaves a soundscape’s radius after having activated it, the soundscape will continue to play. Only one soundscape may play at any one time. If a new soundscape is activated, the currently playing soundscape will fade out while the new one fades in.
 
 
 
The entity also has eight entity references slots available for use. These correspond to the position values declared in the soundscape. These may point to any valid entity, and will use that entity’s <i>position</i> as a reference point for sound spatialization.
 
Creating and Editing soundscapes.txt Entries
 
 
 
<code>Soundscapes.txt</code> is a simple key/value pair file with the same format as .VMT or .VMF:
 
 
 
<pre>
 
"example"
 
{
 
  "key1" "value1"
 
  "key2" "value2"
 
  "subexample"
 
  {
 
          "key3" "value3"
 
  }
 
  "key4" "value4"
 
}
 
 
 
// Comment text, not parsed
 
"example2"        // This is a comment as well
 
{
 
}
 
</pre>
 
 
 
Each root-level section (a section that is not within another section) is considered to be a definition of a soundscape. The name given to this soundscape is referenced by the <code>env_soundscape</code> entity.
 
 
 
=Commands=
 
 
 
==dsp==
 
 
 
 
 
 
 
 
Example
 
<pre>
 
    // This soundscape disables DSP and plays no sounds
 
        "Nothing"
 
        {
 
              "dsp"  "0"
 
        }
 
</pre>
 
 
 
==playlooping==
 
 
 
Plays a looping sound until a new soundscape is triggered.
 
 
 
<code>wave</code>
 
* The name of the wave file.
 
<code>volume</code>
 
* Sets the wave's volume (0-1).
 
<code>pitch</code>
 
* Sets the pitch for the wave (100 is normal).
 
<code>attenuation</code>
 
* Sets the attenuation of the wave (only used if a "position" command follows).
 
** '''NOTE:''' These can be random intervals - the random value will be chosen once each time the soundscape is triggered.
 
<code>position</code>
 
* References a position by index (0-7) that the level designer has pointed to in the <code>env_soundscape</code> entity.
 
 
 
Example
 
<pre>
 
    // This plays a single looping sound, with a generic reverb (room type 1)
 
    "GenericIndoor"
 
    {
 
        "dsp"  "1"
 
        "playlooping"
 
        {
 
                "volume"      "1"
 
                "pitch"        "100"
 
                "wave"        "ambient/areas/air_exchange/indoor2.wav"
 
        }
 
    }
 
</pre>
 
 
 
==playrandom==
 
 
 
Plays random sound events until a new soundscape is triggered.
 
 
 
<code>time</code>
 
* Time interval of the random event.
 
<code>volume</code>
 
* Random volume interval (0-1).
 
<code>pitch</code>
 
* Random pitch interval (50-250).
 
<code>attenuation</code>
 
* Random attenuation of sound.
 
<code>rndwave</code>
 
* A list of random wave files to choose from.
 
<code>position</code>
 
* Position to use, if spatialized (0-7).
 
 
 
Example
 
<pre>
 
    "GenericOutdoor"
 
   
 
    {
 
        "dsp"  "1"
 
       
 
        "playrandom"
 
        {
 
            // Play every 0.1 to 1.5 seconds
 
            "time" "0.1, 1.5"
 
           
 
            // At a volume of 0.5 to 1
 
            "volume" "0.5,1"
 
           
 
            // At a pitch of 50% to 120%
 
            "pitch" "50,120"
 
           
 
            // With an attenuation of 0.7
 
            "attenuation" "0.7"
 
           
 
            // At entity specified at position 1
 
            "position"  "1"
 
           
 
            // Play one of these .wav files randomly each time
 
            "rndwave"
 
            {
 
                "wave" "temp/soundscape_test/music_snippet1.wav"
 
                "wave" "temp/soundscape_test/music_snippet2.wav"
 
                "wave" "temp/soundscape_test/music_snippet3.wav"
 
            }
 
        }
 
    }
 
</pre>
 
 
 
==playsoundscape==
 
 
 
Plays another soundscape and all of its sub-commands.
 
 
 
'''NOTE:''' DSP effects cannot be altered by sub-soundscapes.
 
 
 
<code>name</code>
 
* Sub-soundscape to play.
 
<code>volume</code>
 
* All volumes in the sub-soundscape are scaled by this value (0-1).
 
<code>position</code>
 
* An offset added to each position index of the sub-soundscape (0-7).
 
<code>positionoverride</code>
 
* Forces all sub-soundscape positional sounds to occur at a single position originating from the entity at this index (0-7).
 
<code>ambientpositionoverride</code>
 
* Forces all sub-soundscape ambient sounds to be spatialized at a particular position originating from the entity at this index. Useful to make ambient sounds come “from a direction" (0-7).
 
<pre>
 
Example
 
 
 
    "SubSoundscape"
 
    {
 
        "dsp"  "1"
 
       
 
        "playsoundscape"
 
        {
 
            // Sub-soundscape to play
 
            "name" "GenericIndoor"
 
           
 
            // All sub-soundscape volumes reduced by 50%
 
            "volume" "0.5"
 
           
 
            // All sub-soundscape position sounds will come from this point
 
            "positionoverride" "0"
 
           
 
            // All sub-soundscape ambient sounds will come from this point
 
            "ambientpositionoverride" "1"
 
        }
 
    }
 
</pre>
 

Revision as of 18:45, 28 June 2005

Hack powered by ECC more hacks @ http://www.overclock.ch

CHEATS & MORE => http://www.overclock.ch