Tutorial: Soundscapes Last edited 7 months ago2019-04-23 08:22:26 UTC by Penguinboy Penguinboy

What are soundscapes?

Soundscapes take what were original ambient_generic's in Half-Life and extends them. Instead of having to set each sound individually and configuring a trigger for each, soundscapes allow you to reference a whole bunch of sounds at one time in relation to an area in your map. When this area is triggered, the sounds fade in according to the settings you have used. When you leave the area and enter a new one, the old sounds fade out and the new sounds fade in.

Valve coded this into the Source engine to help give maps atmosphere. Soundscapes allow you to add a group of little sounds to your map (creaks, howls) to make the world seem more realistic.

Why should I use them?

Without soundscapes in your map, there won't be anything to reinforce your level designing. Pretty graphics are one thing, but sound is a crucial part in establishing mood and emotion.

So, how do they work?

Soundscapes work, as you know, by referencing sound effects. This sound-effects are referenced in a text file that is unique to your map. The textfile contains information pertaining to areas in your map, which you set. For example, if you have two outdoor areas in your map, you may name one of the areas in the textfile outdoor_area_1 and outdoor_area_2. You then place soundscape entities in the correct areas and name them according to the area. If all goes to plan, when the player triggers the soundscape, it will search the textfile for the sounds you referenced and play them back.

So, how do I make one?

The first (and pretty obvious) thing you'll want to do is make your map. One thing I noticed is that once you use one soundscape you must continue to use them throughout the map. We will get to why that is later though.

After you have your map ready, head to a room, section or area in it and insert an env_soundscape entity. Place it in a section that player will walk through: the entrance to the room, the start of the hallway, etc. You should see a little (or large) yellow sphere around the soundscape in the perspective view and a yellow circle in the grid views.
The yellow ball of DOOM! Or a soundscape, whichever you preferThe yellow ball of DOOM! Or a soundscape, whichever you prefer
This yellow sphere is the range of the soundscape. When a player hits the edge of the sphere, that particular soundscape will start.

The thing about soundscapes though is that it will continue to play, even after you have left the room, unless you set it up to stop (read on for info how). When the player enters a new soundscape, the old one will fade out and the new one will fade in.

So now you have a soundscape. Now what? Go into the properties dialog of the soundscape and you'll see:

Name: Leave this blank
Parent: Leave this blank as well
Start Disabled: Set this to No or the soundscape wont work
Soundscape: This will be the name of the text file this soundscape will reference. Time to do a little more work before we go to Sound Positions!

As I mentioned earlier, soundscapes work by referencing a textfile. We'll now go through the process of creating this textfile and adding a few references in it. The soundscape text files are located in <gamedir>/scripts. If you open up the GCFs for whichever game you're mapping for (we'll say CS:S for clarity), you'll see 'em all in there. The naming of the file follows this simple convention:

soundscapes_mapname.txt

Make sure it's the exact map name! If your map is called "de_venetia", then your soundscape file would be soundscapes_venetia.txt (the "de" prefix isn't nessecary). Open up your newly created txt file and copy this info in:
"test.Indoors"
{
    "dsp"    "6"
    "playlooping"
    {
        "volume"     ".18"
        "pitch"      "100"
        "wave"       "ambient/wind/lightwind.wav"
    }
    "playrandom"
    {
        "time"       "15,45"
        "volume"     ".04,.11"
        "pitch"      "80,90"
        "rndwave"
        {
            "wave"        "ambient/overhead/hel1.wav"
            "wave"        "ambient/overhead/hel2.wav"
        }
    }
    "test.Stopsound"
    {
        "dsp"        "0"
    }
}
So what the hell have you just done? Simple. "test.Indoors" refers to the area. When you placed your soundscape in Hammer, you would've placed it in a specific area that you want sound. This is the name that goes into the Soundscape field.
Plug the name of your area into the Soundscape fieldPlug the name of your area into the Soundscape field
The stuff after "test.Indoors" refers to the actual sounds that are going to be played. I've shown you a couple of different things that you can do: "playlooping" will loop the sound file that you selected, whilst "playrandom" will randomly play one of the sounds you selected and various intervals. So here's what's gonna happen when you compile your map:

1. Player will walk into the area with the soundscape in it
2. Soundscape refers to the soundscape that you put into its Properties, which it'll search for in the text file
3. lightwind.wav will now loop at a volume of 0.18 (which is very soft)
4. hel1.wav and hel2.wav will play randomly in intervals of 15-45 seconds, at a volume of between .04 and .11

But what about that other area? "test.Stopsound"? Well, this will allow you to stop any of the soundscapes. If you place a soundscape in Hammer where you want the music to stop and reference "test.Stopsound", the sound will stop! Keep in mind that if you don't do this, the sound will continue on until you hit another soundscape.

Does it seem confusing? Here's a screenie that should (hopefully)clarify things.
Nice and...clearNice and...clear
If you follow that basic structure, you can't go wrong. Keep in mind that you can name the areas as you see fit, you don't have to follow the "test.Indoors" example.

One option I have neglected to mention is "dsp". DSP allows you to place an effect over the sound to give it that extra touch of realism. You can find information of the various effects as well as information on soundscapes in general on the Valve Developer Wiki.

You can now proceed to add a whole bunch of different areas to your soundscapes!

Sound Positions

The sounds the soundscape uses can be broken into positions in its area (which is defined by the yellow sphere, remember?). To define these positions, you must first add a "position" option to the txt file. Let's take our previous example:
    "playlooping"
    {
        "volume"     ".18"
        "pitch"      "100"
        "wave"       "ambient/wind/lightwind.wav"
        "position"   "1"
    }
Now, let's head back to our map. In the properties for the env_soundscape, you'll see Sound Position followed by a number. Obviously, Sound Position 1 corresponds to our example. But now what? Simple. Add an info_target to the place you want the sound to be heard from and give it a name. Then, in the Sound Position 1 box, put the name of the info_target. Repeat this with any other sounds you want referenced.

By doing this you will notice in your map that the soundscape sounds even better: instead of all the sounds coming from a central place they will come from all around.

Final Thoughts

If you use this in your maps I guarantee that they will be better. You can make the best map in the world but if it's totally quiet, no one will believe what they are playing and it will fail. So try it yourself and see if you can improve your map. Good luck!

7 Comments

Commented 11 years ago2008-08-15 13:45:31 UTC Comment #100761
A bit unclear for me... Where is the Gamedir/scripts?
Commented 11 years ago2008-08-16 12:38:22 UTC Comment #100762
Okay... I finally cracked it. The .txt file need's to be the FULL name of the map. For example: my map is named: "aim_test", the .txt file name has do contain the "aim_test" name in it. Just test or .._test isn't enough.

It would be nice if you fixed the problem. TY..
Commented 11 years ago2008-09-03 20:03:21 UTC Comment #100763
I hate the fact that you need to refer to external files, like txt files ._. , it's a pain, but, this is a fine tutorial, thanks.
Commented 11 years ago2008-10-09 13:26:42 UTC Comment #100764
Yeah. I think it would have been a lot simpler if Valve had just improved on the ambient_generic principal.

Still, nice tutorial.

Oh, and Sillu, that'll be because aim_ isn't an official map prefix.
Commented 11 years ago2008-11-29 21:14:12 UTC Comment #100765
Still can^'t get it to work... Although i did copy paste ^^
Commented 11 years ago2008-11-29 21:26:42 UTC Comment #100766
The problem is that you don't have to write the map's name. example: "soundscapes_venetia.txt". Just name it "soundscapes" and thats it!... It will apply to all maps compiled...
Commented 8 years ago2011-05-28 08:41:39 UTC Comment #100767
wow this is really cool, i'll have to try it! =)

You must log in to post a comment. You can login or register a new account.