WiseSound: Sounds

From Valve Developer Community
Jump to: navigation, search

This tutorial was originally created by wisemx.

Ported from SDKnuts.net to VDC by: Pinsplash (talk) 14:52, 3 July 2018 (UTC)

Introduction

There have been many requests for tutorials on placing and controlling sound in Source maps. If you are having trouble getting ambient sounds to play after each round in CS:Source see below for an example file that uses a logic_auto to play the sound of fire after each round in CS:S.

I decided to make this project fun and created a “water drop”.

In this project we will be standing high above some water and there’s a hole we drop into. The sounds we’ll hear are:

  1. Ambient sound of a shore line from HL2.
  2. A woman yelling as we fall.
  3. Another woman laughing as we hit the water.
  4. We are teleported back to where we started.

For this project we are going to use two types of Source sound entities:

  1. ambient_generic
  2. env_soundscape

With the ambient_generic sound entity we can search for our sounds in the Sound Resource Browser by clicking the Browse button for Sound Name in the properties. With the env_soundscape we will need to know the sentence name. You can find these out yourself with a program like GCFScape that can extract files from your HL2 game files. These are the *.vpk files in your hl2\ folder. I’ll list 245 valid names that can be used. Don’t worry about all of that now, you will not need to extract anything, we will be covering everything you will need in this tutorial and it’s going to be rather simple.

There are many differences between these two types of sound entities but for me the best thing about Soundscapes is they are scripts for sounds, instead of simply playing a sound they can play multiple sounds and change the attributes for each of them. As an example the loud noise of machinery with the faint distant noise of frogs and crickets.

Creation

First thing I did was create the water drop. It’s big but if you want to use it in a map go right ahead, it’s faster then an elevator or stairs. In the water drop the player jumps through a hole then falls several “floors” into a pool of water. When they hit the water I teleport them back to the spot they started on. The sound effects are a combination of ambient sounds from our one env_soundscape and then two ambient_generics via triggers the player will pass through on their way down. I played with the timing of the triggers until all of the sounds blended together perfectly.

That’s a key element in making sounds work properly in your maps! Don’t try to play one sound event during a sound event if you want the full effect from both sounds. This does not include your ambient sounds, they can have a wide radius and still blend in well with sound events.

For example on the coast levels of HL2 you are always surrounded by very powerful ambient sounds however they do not drown out the sounds of gun fire or birds. You can achieve blended sounds by experimenting with placement, timing and settings. (I apologize that a tutorial like this one has to be both basic and advanced.)

The first sound entity we’ll be placing is the env_soundscape and I’m going to place it right where the player will spawn.

  • Start Disabled: No
  • Radius: 500
  • Soundscape: coast.bridge_ambient

When the map loads and the player joins the ambient sounds from one of the HL2 coast scenes will play in the background at all times. These sound entities have a Radius and Line of Sight so if we wanted to change the ambient sounds we would place another where the player would be in range of it. Only one of these will play for the player at a time, but that’s a good thing. (allows more control)

Now lets place those two ambient_generic sounds.

  • Name: WaterJumpTriggerF1Sound
  • Sound name: vo\coast\odessa\female01\nlo_cheer03.wav
  • Volume: 10


  • Name: WaterJumpTriggerF2Sound
  • Sound name: vo\coast\odessa\female01\nlo_cheer02.wav
  • Volume: 10
  • Flags: Start Silent, Is NOT Looped

Notice that the ambient_generic sound entity has a property SourceEntityName. This is where we would enter the name of any entity that we wanted the sound to originate from instead of being ambient. We don’t need to do that for this but we could give each of our triggers a name and this is the name that would go in each SourceEntityName.

Our player will trigger the two ambient_generic sounds by means of triggers we will be creating with two brushes placed in the players path of decent. Press Ctrl+T to tie these brushes to trigger_multiple.

Properties for the two trigger_multiples:

  • Start Disabled: No
  • Delay before reset: 2
  • Flags: Clients

Here’s what our triggers and sounds look like in Hammer:

WiseSoundWaterDrop setup.png

Notice that those triggers don’t need to be very large. You’ll find your own methods for placing your triggers to sounds and other events, at times they might be horizontal like these, vertical or you might need to create large cubes.

To make this work we need to create one output in each of the triggers.

Top trigger:

  My Output Target Entity Target Input Parameter Delay Only Once
Io11.png OnStartTouch WaterJumpTriggerF2Sound PlaySound 0.00 No

Lower trigger:

  My Output Target Entity Target Input Parameter Delay Only Once
Io11.png OnStartTouch WaterJumpTriggerF1Sound PlaySound 0.00 No

You can make custom soundscapes! With proper naming of your soundscape script the game will load it when your map loads. The Soundscape name and location should be like this: <mod folder>\scripts\soundscapes_yourmapname.txt

See Also