Ambient generic
		
		
		
		Jump to navigation
		Jump to search
		
Template:Wrongtitle Template:Base point
A simple sound source, able to play both looping and non-looping sounds from a position within the world.
Use it to play and control a soundscript sound, a raw .wav sample or a single scripted sentence. In case of a scripted sentence you have to replace the path and filename with "!", followed by the sentence name.
 Bug:Ambient_generic entities used to play looping ambient noise in Counter-Strike Source must be activated with a logic_auto or they will stop playing once the first round starts.  [todo tested in ?]
Bug:Ambient_generic entities used to play looping ambient noise in Counter-Strike Source must be activated with a logic_auto or they will stop playing once the first round starts.  [todo tested in ?] Note:This entity is no longer intended to be used to generate environmental sounds. Use the (new to Source) env_soundscape for this purpose. Ambient_generic is largely retained for playing music or other one-shot sounds.
Note:This entity is no longer intended to be used to generate environmental sounds. Use the (new to Source) env_soundscape for this purpose. Ambient_generic is largely retained for playing music or other one-shot sounds.Fixing bugs
Problems with sounds being unstoppable (detailed below) can be avoided by including this C++ code in your mod's binaries.
See also
- env_soundscape - an entity used for changing DSP settings and ambient soundscapes.
External links
- Setting up ambient_generics in Counter-Strike: Source using logic_auto - a substitute for creating a proper env_soundscape.
Details
Keyvalues
- Template:Kv targetname
- message
- <sound> Name of the GameSound entry for the sound to play. Also supports raw .wav filenames and sentence scripts.
- health (Volume)
- <integer:0-10> Sound volume, expressed as a range from 0 to 10, where 10 is the loudest. Defaults to 10.
- preset
- Literal Value - Dynamic Preset - 0 - None - 1 - Huge Machine - 2 - Big Machine - 3 - Machine - 4 - Slow Fade in - 5 - Fade in - 6 - Quick Fade in - 7 - Slow Pulse - 8 - Pulse - 9 - Quick pulse - 10 - Slow Oscillator - 11 - Oscillator - 12 - Quick Oscillator - 13 - Grunge pitch - 14 - Very low pitch - 15 - Low pitch - 16 - High pitch - 17 - Very high pitch - 18 - Screaming pitch - 19 - Oscillate spinup/down - 20 - Pulse spinup/down - 21 - Random pitch - 22 - Random pitch fast - 23 - Incremental Spinup - 24 - Alien - 25 - Bizzare - 26 - Planet X - 27 - Haunted 
- volstart
- <integer> Volume to start fading in at.
- fadein [deprecated]
- <integer> Fade in time (0-100)
- fadeout [deprecated]
- <integer> Fade out time (0-100)
- fadeinsecs (in all games since  ) )
- <integer:0-100> How long to fade in for.
- fadeoutsecs (in all games since  ) )
- <integer:0-100> How long to fade out for. Will delay any StopSound inputs to allow for the fade.
- pitch
- <integer:1-255> Sound pitch, expressed as a range from 1 to 255, where 100 is the sound's default pitch.
- pitchstart
- <integer:1-255> Pitch to begin spinning up at.
- spinup (Spin up time)
- <integer:0-100>. Analogous to fadeinsecs, but affecting pitch.
- spindown (Spin down time)
- <integer:0-100>. Analogous to fadeoutsecs, but affecting pitch.
- lfotype
- <integer> LFO type
- Literal Value - LFO type - 0 - Off - 1 - Square Wave (alternate between low and high) - 2 - Triangle Wave (sharper transitions) - 3 - Random 
- lforate (LFO rate)
- <integer:0-1000> How frequently the LFO effect repeats itself.
- lfomodpitch (LFO modulation - pitch)
- <integer:0-100>, affects the sound pitch or vibrato. Higher numbers change the pitch more - warbling singers use little, police sirens use a lot.
- lfomodvol (LFO modulation - volume)
- <integer:0-100> Affects the volume of the sound, causing it to "pulse." Similar to tremolo.
- cspinup (Incremental Spinup Count)
- <integer> Appears to be a method for increasing pitch in time with ToggleSound inputs, but:
 Bug:Non-functional.  [todo tested in ?] Bug:Non-functional.  [todo tested in ?]
- radius (Max Audible Distance)
- <string> Maximum distance at which this sound plays for a client.
 Note:The Volume (health) of this sound slowly fades to 0 as the player approaches the max distance, which makes it seam like this sound stops playing before then. Note:The Volume (health) of this sound slowly fades to 0 as the player approaches the max distance, which makes it seam like this sound stops playing before then.
- SourceEntityName
- <targetname> If an entity is specified, sound will come from this named entity instead of the location of ambient_generic. If the target is an NPC capable of lipsynching, and phoneme data is found within the sound, the target will lipsynch to it.
Flags
- 1 - Play everywhere
- Sound always plays from all speakers at its configured volume. It doesn't bypass DSP effects, however.
 Bug:This flag is broken at engine level for Soundscripts. It will only work when a sound is played with its raw filename.  [todo tested in ?] Bug:This flag is broken at engine level for Soundscripts. It will only work when a sound is played with its raw filename.  [todo tested in ?]
- 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!  [todo tested in ?] Bug:Looping sounds that do not start silent cannot be controlled!  [todo tested in ?]
- 32 - Is NOT Looped
- Changes how the ambient_generic handles stopping and starting playback. This flag won't stop a sound that loops from looping, but it is still important to set it to the right value. You might not be able to stop and/or start the sound if it isn't!
Inputs
- Pitch <integer>
- 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! It is speculated that the input is supposed to change the pitch at which the ambient_generic plays its sound when prompted by other inputs, not play it by itself.  [todo tested in ?] Bug:Pitch 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 pitch at which the ambient_generic plays its sound when prompted by other inputs, not play it by itself.  [todo tested in ?]
- PlaySound
- Starts the sound.
- StopSound
- Stops a looping sound.
 Note:Does not stop a non-looping sound. This is intentional, and can be changed with C++. Note:Does not stop a non-looping sound. This is intentional, and can be changed with C++.
- ToggleSound
- Toggles a looping sound between playing and stopped. Behaves like PlaySound if the sound is unlooped.
- Volume <integer>
- 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.  [todo tested in ?] 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.  [todo tested in ?]
- FadeIn <integer> (in all games since  ) )
- Fades the sound up to full volume over a specified number of seconds, with a range from 0 to 100 seconds.
 Bug:Non-functional.  [todo tested in ?] Bug:Non-functional.  [todo tested in ?]
- FadeOut <integer> (in all games since  ) )
- 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.  [todo tested in ?] Bug:Will bring the sound up to full volume (i.e. 10) before beginning to fade it.  [todo tested in ?]
