Sound effects change on location

I am working on a map where it is raining. At the moment I have an ambient_generic set to play the rain sound effect everywhere. As you know in real life, if you went inside or under ground like some areas are in my map. You would barely hear the rain(if at all). Is there a way to set a sound to play and change depending on where the player goes?

By the way, I using a custom rain sound effect.

I believe you may have to code this in.

Couldn’t you have lots of small ambient_generics to do it for you? I don’t really know, I’ve never managed to make sound work in any of my maps.

I suppose I could strategically place amb_gen’s around the map… I’ll give that a go.

[editline]21st May 2011[/editline]

For custom sounds just encode your WAV’s to 44100Hz at 24bit and under, works for me.

No, I mean any sounds at all, even Valve’s ones. It just never seems to work properly.


the trigger brush for the entity

i may be wrong though, never experienced with soundscapes

Here’s a solution:
Make two ambient_generics of the same rain sound,one at volume 10 and the other 4 or 3 just or however loud you want to hear it when you’re inside.
Now name the louder ambient_generic,create a trigger_multiple brush over the area that is supposed to be inside with a reset delay of 0.
Set the outputs of the trigger to:

Output: OnStartTouch
Target: louder ambient_generic’s name
Input: FadeOut
Parameter: 1


Output: OnEndTouch
Target: louder ambient_generic’s name
Input: FadeIn
Parameter: 1

So whenever you enter the inside area the rain sound will become quiet and when you exit the area it will fade to normal volume.You can also use this way to fade in a different sound while being inside etc.
Hope this helps.

Excellent idea! Will try that out. I may edit the rain sound to give an “inside” effect. Love your idea, will add you to credits if you like.

soundscpaes can work well. After using them in TF2 maps (adding floods to the official ones that is). I found they are very nice to use, you can hear a soundscape that you can “see”, so if a door closes and there is a soundscape on either side, you should only hear the one on your side now.

I wish there was an option that prevents ambient_generics to fade out if your distance from it increases.
Or rather, set the start/end fade distance, just like with light entities.

Umm,just the check “play everywhere” flag or adjust the radius cirle in the 2d view.

Could someone check these scripts for me please, make sure I’ve done it right. Thank you.

soundscapes_manifest.txt - Located in: garrysmod/scripts/

	"file"		"scripts/soundscapes.txt"

	// List additional soundscape files here
	"file"		"scripts/soundscapes_deathrock.txt"


soundscape_deathrock.txt - Located in: garrysmod/scripts/

	"dsp"	"1"
		"volume"	"1.0"
		"pitch"		"120"
		"soundlevel" "SNDLVL_90dB"
		"position"	"0"
		"wave"		"custom/rain.wav"

		"volume"	"0.2"
		"pitch"		"120"
		"soundlevel" "SNDLVL_90dB"
		"position"	"1"
		"wave"		"custom/rain_indoor1.wav"

		"volume"	"0.2"
		"pitch"		"120"
		"soundlevel" "SNDLVL_90dB"
		"position"	"2"
		"wave"		"custom/rain_indoor2.wav"

I’m hoping to use this as a way to create various rain effects through the map. For example the rain sound effect outside will be normal, when you go inside a building it will be the same rain effect with some filters added to make it sound like it raining outside. Then the last one will have even more filters added so you can only just hear it.

I’ve never made custom soundscapes before so I’m not sure if I’ve done these correctly.

Like i said, “start/end fade distance” not just the radius.

I use env_soundscape_triggerable’s in my maps to achieve exactly what you are describing. You can see an example of it in my gm_adventurers map (go to the Library and pull the “HARD RAIN” book off the shelf, and it will start raining. Walk around the building, and you will only hear rain in the Library)

Wow Firegod, you of all people I expected to know how to do this. I guess you profession is just lighting V:v:V

would give you a better effect to trace the amount of cover over you and then lower the pitch and make it quieter like that.
not to mention more dynamic. you could have a prop over your head and it would slightly dampen.

Why not make it a soundscape?

Ok, here’s how I do my outdoor/indoor sounds.
Oh, and before you start reading, if I’m not reliable to you enough, this should help:

-Scroll down to the custom soundscapes area for this.

The first thing you need to do is write a soundscape for interiors and the exterior rain, I’ve set a base one up for you. READ THIS FIRST: If you want seperate soundscapes for the interior and exterior, copy and paste everything I said in the txt document twice, and re-set it up.
Download the setup here:

I set up the pointers so you should be able to get it without leaving the .txt file, if not, consult the wiki page

After that is working, you’ll need to open up your map. Create an “env_soundscape” entity and place it way high in the top of your map, outside of any buildings or brushes. Set the distance to cover the entire map (it can go over the map’s borders, don’t worry)
Set the “soundscape” parameter to whatever you named your exterior rain one.

Now go inside all the buildings/areas that you want to have the soundscape play, and put a soundscape with the name of your interior one at ALL the entrances to it. Soundscapes can not travel through brushes, but will memorize the last soundscape you heard even if you leave the vicinity until another one appears.

Now, even though this is a pretty effective way (in my opinion) to do this, there’s some cons, so beware!

1.This tutorial is by me, no brainer
2.It takes a while depending on how many buildings you have to put them all in
3.Noclipping in and out of areas away from entrances doesn’t play the interior soundscape until you go by the entrance

Oh, and anyone who denies this works, this is the same thing they did for left 4 dead 1 + 2 and portal 2
Hope I helped!

:siren:Oh, and if anyone wants to know how to port Left 4 Dead 2/Portal 2 maps to Garry’s Mod and Earlier Source games, PM me.:siren:

Wow, thank you. I will try this out first thing tomorrow.

I’m setting up the soundscape files an I’m having trouble getting them to appear in Hammer.

Here is the soundscape im trying to add. Although I’m a little confused about the first part “playrandom”, do I leave this in or can I delete it as I don’t need it?

//Soundscape tutorial by Chaingunfighter1

"gm_deathrock.rainoutdoors" //Name of the soundscape, make an easy to-remember name, trust me.

		"volume"	"0.4,0.8" //The volume of the sounds
		"time"		"10.0, 18.0"//Time in (Seconds) which sound effects play
		"pitch"		"100,100"//This is the pitch of the sounds, 100 is default sounds, just keep it like this
		"position"	"random"//This will make random sounds come from a random location, keep it like this.
			"wave" "ambient\materials\rock1.wav"  //This is how sounds that randomly play should be set up, the GCF should provide the file path for these.

	         "dsp"   "1" 

                "volume"       "1" //Normal volume
                "pitch"        "100" //Pitch, keep this like it is.
                "wave"         "custom/rain.wav" //The looping sound, USE THIS FOR YOUR RAIN!


//The soundscapes_MAPNAMEHERE must be the name of your map. E.G. a map named gm_blah would be soundscapes_gm_blah
//Never change the file type, .txt is the only working soundscape file type.
//The soundscape should stay in the "scripts" folder, when releasing, make sure this is in the scripts folder.

I’ve also added it to soundscapes_manifest.txt like so:

	"file"		"scripts/soundscapes.txt"

	// List additional soundscape files here
	"file"		"scripts/soundscapes_lostcoast.txt"
	"file"		"scripts/soundscapes_citadel_episodic.txt"
	"file"		"scripts/soundscapes_city_episodic.txt"
	"file"		"scripts/soundscapes_canals.txt"
	"file"		"scripts/soundscapes_klab.txt"
	"file"		"scripts/soundscapes_elab.txt"
	"file"		"scripts/soundscapes_streetwar.txt"
	"file"		"scripts/soundscapes_citadel.txt"
	"file"		"scripts/soundscapes_town.txt"
	"file"		"scripts/soundscapes_coast.txt"
	"file"		"scripts/soundscapes_prison.txt"
	"file"		"scripts/soundscapes_trainyard.txt"

	//episode 2
	"file"		"scripts/soundscapes_silo.txt"
	"file"		"scripts/soundscapes_outland.txt"	
	"file"		"scripts/soundscapes_outland2.txt"
	"file"		"scripts/soundscapes_gm_deathrock.txt"


I’m restarting to Hammer each time I make any changes and click refresh sounds. My only guess is that the original soundscapes_manifest.txt in the GCF file is overriding the new one. Or should the new one which I extracted to the scripts folder override the original one?

Edit: I’ve spent over an hour on this now and I’m pulling my hair out… Hammer just will not find the new soundscape file. I even found a program that create’s soundscape files for you(

Please, someone help.