|Availability||In all games|
ambient_generic is a point entity available in all Source games.
This entity plays a sound, either once or on loop and either from a location in the world or globally. Use it to play and control a soundscript sound, a raw
.wav sample, or a
Tip: This entity can be parented if the
parentname keyvalue or
SetParent input is used, even though they aren't listed in the FGD.
ambient_generics used to play looping sounds in Counter-Strike: Source must be activated with a
logic_auto, or they will stop playing once the first round starts.
ambient_generic will not update its position while the sound is playing if it is parented.
Bug: Killing this entity while a looped sound is playing will make it play forever for the entire map duration. This also may cause looping sounds to stack up and eventually overflow the sound limit (detailed blow), even if they aren't audible.
Bug: Looping sounds might become attached to certain players when they are not supposed to. E.g., if you are away from a sound, and a player near the sound dies and then spectates you, the sound may become attached to you. The exact consistency/behavior of this bug is still unknown.
Bug: Too many
ambient_generics playing at once will cause the sound engine to become corrupted globally and potentially cause extreme lag! This occurs if the internal entity sound limit of 64 (32 in ) is hit. Due to another bug,
ambient_generics still "play" when outside the maximum distance, even if not audible to the client.
env_soundscapes (which count towards a different static limit of 64) where possible and forcefully disable any sounds that aren't necessary to play yet. The amount of sounds currently playing can be visualized with the
Bug: Looping sounds using LFO cannot be stopped via the
Note: The behavior of sound is different for mono and stereo. Stereo sounds only fade in and out (they are already using surrounding information built into them). Mono sounds are processed by the audio engine to sound like they are coming from a specific position.
Warning: Using the Soundscript name of a sound, as opposed to its "raw" audio file, will apply all the soundscript settings.
Example: In Left 4 Dead 2, the soundscript of
dlc.Generator_start_run_loop is set to play everywhere but at lower volume even if "Play everywhere" is not set. But using its raw sound
Generator_start_run_loop.wav works as intended.
- Sound Name
- The soundscript name of, or direct path to, the sound to play. For
scripted_sentences, type "!" followed by the sentence name. (Example: !COMBINE_THROW_GRENADE4)
Note: Playing music without a soundscript is not recommended due to a bug with the Play Everywhere flag. Note: Using any sound characters in a direct path is, in a way, a soundscript.
- Max Audible Distance
- Maximum distance in units at which the sound plays for a client.
Bug: The sound still actually plays outside the distance. Bug: Sounds may still be audible far outside the distance due to DSP. Note: Volume fades to nothing as the player approaches this distance, which can make it seem as if the sound stops playing too early.
- If specified, the sound will play from this entity instead of the
ambient_generic. If the target is an NPC capable of lipsynching, and phoneme data is found within the sound, the target will lip-sync to it.
Bug: If the
Killed, the sound will play at the origin of the map (at 0,0,0).
Bug: The entity must be spawned at map start, or else the sound will play at the location of the
AddOutput to assign the
SourceEntityName after the entity spawns does not work.
ambient_generics won't stack on the same entity.
ambient_generic will only play from a single entity. If there are multiple entities with the same target name, the sound will only play from the first one it finds.
Confirm:is this all games? only tested in .
- How loud to play the sound. 0 is silent and 10 is normal. Default is 10.
Tip: This keyvalue doesn't allow decimals, but the
Volume input does.
Bug: The sound does not play at all if the volume is 0.
- Start Volume
- Fade in time in seconds
- Fade out time in seconds
- How long to spend fading in and out, and what volume to start at. Default is no fading.
- Pitch, where 1 is low, 100 is normal, and 255 is high.
Bug: Very high or very low values can cause other sounds to be distorted.
- Start pitch
- Spin up time
- Spin down time
- How long to spend spinning pitch up/down at the start/end of playback, and what pitch to start at. Default is no spinning.
- Dynamic Presets
- Various DSP effects that can be applied.
- LFO type
- Type of Low Frequency Oscillation to employ.
- 0. Off (default)
- 1. Square Wave (alternate between low and high)
- 2. Triangle Wave (crossfade between high and low)
- 3. Random
- LFO rate
- How frequently the LFO effect repeats itself.
- LFO modulation - pitch
- Affects the sound pitch or vibrato. Higher numbers change the pitch more; warbling singers use little, police sirens use a lot.
- LFO modulation - volume
- Affects the volume of the sound, causing it to "pulse." Similar to tremolo. At a really high rate, this can make the same effect as talking through fan blades.
- Incremental Spinup Count
- Appears to be a intended to increase pitch in time with
1] : Play everywhere
Sound plays at a constant volume, no matter how far away the listener is from the sound source.To do: How does this interact with
env_microphone sound detection?}
Bug: This flag is broken at engine level for sounds played from Soundscripts. It will only work when a sound is played with its raw filename.
16] : Start Silent
The map will start without this sound playing. Enabled by default.
Bug: Looping sounds that do not start silent cannot be controlled!
32] : Is NOT Looped
Changes how the
ambient_generic handles stopping and starting playback. It won't stop a sound that loops from looping, but it is still very important to set it to the right value. You might not be able to stop and/or start the sound if it isn't!
Bug: Having this option ticked while using a looped sound WILL prevent you from controlling it!
- Sets the sound pitch, expressed as a range from 1 to 255, where 100 is the sound's original pitch.
Bug: Pitch will play the sound without informing the rest of the entity. This makes looping sounds unstoppable!.
- Starts the sound.
- Stops a looping sound. Does not stop a non-looping sound; however, a non-looping sound can be stopped by using the Volume input with a value of 0.
Code Fix: If necessary, you can allow this input to stop a non-looping sound via C++.
- Toggles a looping sound between playing and stopped. Behaves like
PlaySound if the sound doesn't loop.
- Plays the sound at a volume from 0 to 10, where 10 is the loudest.
Bug: Volume will play the sound without informing the rest of the entity. This makes looping sounds unstoppable! It is speculated that the input is supposed to change the volume at which the
ambient_generic plays its sound when prompted by other inputs, not play it by itself.
Note: Setting the volume to 0 will cause the sound to pause, rather than play silently.
- Fades the sound up to full volume over a specified number of seconds, with a range from 0 to 100 seconds.
Bug: Non-functional outside of Portal 2.
- Fades the sound to silence over a specified number of seconds, with a range from 0 to 100 seconds.
Bug: Will bring the sound up to full volume (i.e., 10) before beginning to fade it.