Destinations/Adding Sound: Difference between revisions

From Valve Developer Community
Jump to navigation Jump to search
mNo edit summary
Line 30: Line 30:
                 "playlooping"
                 "playlooping"
                 {
                 {
                                 "volume"                             "0.5"
                                 "volume"       "0.5"
                                 "pitch"                                 "100"
                                 "pitch"         "100"
                                 "wave"                                 "sounds/forest.vsnd"
                                 "wave"         "sounds/forest.vsnd"
                 }
                 }
                 "playrandom"
                 "playrandom"
                 {
                 {
                                 "volume"                             "0.35"
                                 "volume"       "0.35"
                                 "pitch"                                 "100"     
                                 "pitch"         "100"     
                                 "time"                                   "10, 15"
                                 "time"         "10, 15"
                                 "soundlevel"     "SNDLVL_50dB"
                                 "soundlevel"   "SNDLVL_50dB"
                                 "position"           "random"
                                 "position"     "random"
                                 "rndwave"
                                 "rndwave"
                                 {
                                 {
                                                "wave"                 "sounds/owl_01.vsnd"
                                      "wave"       "sounds/owl_01.vsnd"
                                                "wave"                 "sounds/owl_02.vsnd"
                                      "wave"       "sounds/owl_02.vsnd"
                                                "wave"                 "sounds/owl_03.vsnd"                                                   
                                      "wave"       "sounds/owl_03.vsnd"                                                   
                                 }
                                 }
                 }
                 }
Line 51: Line 51:
</pre>
</pre>


''Note: The .vsnd extension is the compiled version of audio files in Source 2.''
''Note: The .vsnd extension is for the compiled version of audio files in Source 2. When the sound first plays, it will get compiled into a .vsnd automatically. You don't need to change the audio file extension by hand, just use .vsnd in the soundscape script.''


* Build the map and you'd now be able to hear forest.wav looping, and at randomized start times with a 10 to 15 second gap, one of the owl files playing from a random position around the listener.
* Build the map and you'd now be able to hear forest.wav looping, and at randomized start times with a 10 to 15 second gap, one of the owl files playing from a random position around the listener.

Revision as of 14:08, 9 June 2016

Overview

The simplest way to add ambient sounds to your Destinations addon is through Soundscapes.

  • If it doesn't already, ensure your addon has a soundscapes_manifest.txt and soundscapes_template.txt file in the scripts directory.
  • Rename soundscapes_template.txt to suit the addon, and then adjust the reference in soundscapes_manifest.txt on line 3 accordingly.

Documentation on how to create custom soundscape entries exists here - [1] Note: Unlike some other Valve titles, Destinations does use reverb DSP.

The map entity required is documented here - [2]

Sound files go in the content/youraddon/sounds/ folder.

Example

Here is an example of a workflow for a simple soundscape, with a looping ambient bed and some randomized spot sounds around the listener.

  • In your map, add an env_soundscape entity. Ensure the radius covers the info_player_start entity by moving it closer and/or adjusting the Radius property in Hammer.
  • In the new env_soundscape entity, set the Soundscape property to the name you want for your soundscape, for example - soundscape_whitelodge
  • Add your audio files to the sounds folder. In this case we'll say there is one looping .wav file called "forest.wav" and three ‘spot sound’ .wav files called "owl_01.wav", "owl_02.wav" and "owl_03.wav". Ensure looping sound files have loop markers set up.
  • Open your soundscapes script and add the following.
"soundscape_whitelodge"
{
                "playlooping"
                {
                                "volume"        "0.5"
                                "pitch"         "100"
                                "wave"          "sounds/forest.vsnd"
                }
                "playrandom"
                {
                                "volume"        "0.35"
                                "pitch"         "100"     
                                "time"          "10, 15"
                                "soundlevel"    "SNDLVL_50dB"
                                "position"      "random"
                                "rndwave"
                                {
                                       "wave"       "sounds/owl_01.vsnd"
                                       "wave"       "sounds/owl_02.vsnd"
                                       "wave"       "sounds/owl_03.vsnd"                                                  
                                }
                }
}

Note: The .vsnd extension is for the compiled version of audio files in Source 2. When the sound first plays, it will get compiled into a .vsnd automatically. You don't need to change the audio file extension by hand, just use .vsnd in the soundscape script.

  • Build the map and you'd now be able to hear forest.wav looping, and at randomized start times with a 10 to 15 second gap, one of the owl files playing from a random position around the listener.
  • Adjust the volume, pitch, time and soundlevel to suit. The VConsole command 'cl_soundscape_flush' will allow you to reload the soundscape to hear tweaks.

Note: If the playlooping or playrandom entry does not include a position, soundlevel will not affect anything as there is no falloff of volume over distance.