Ambient generic: Difference between revisions

From Valve Developer Community
Jump to navigation Jump to search
(fixup and explanations)
Line 1: Line 1:
{{wrongtitle|title=ambient_generic}}
{{wrongtitle|title=ambient_generic}}


== Entity description ==
__TOC__
 
[[Image:{{PAGENAME}}.png|left]]
[[Image:{{PAGENAME}}.png|left]]
Universal ambient sound, useful for both continually looping ambient noise and single-play [[trigger]]ed sound. Use it to play and control a [[Soundscripts|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.
 
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 [[Soundscripts|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.


{{clr}}
{{clr}}


{{note|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.}}
{{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.}}
 
{{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.}}
== See also ==
* [[env_soundscape]] - an entity used for changing [[DSP]] settings and ambient [[Soundscapes|soundscapes]].
==External links==
* [http://www.slackiller.com/New%20Tuts/sound.html Setting up ambient_generics in Counter-Strike: Source using logic_auto] - a substitute for creating a proper env_soundscape.
== Details ==


== Keyvalues ==
=== Keyvalues ===
;{{kv targetname}}
;{{kv targetname}}
;message
;message
:<sound> Name of the GameSound entry for the sound to play. Also supports raw .wav filenames and sentence scripts.
:<sound> Name of the GameSound entry for the sound to play. Also supports raw .wav filenames and [[sentence]] scripts.
;health
;health
:<integer> Sound volume, expressed as a range from 0 to 10, where 10 is the loudest.
:<integer> Sound volume, expressed as a range from 0 to 10, where 10 is the loudest. Defaults to 10.
;preset
;preset
:{|
:{|
Line 77: Line 89:
|}
|}
;volstart
;volstart
:<integer> Start Volume
:<integer> Volume to start fading in at.
;fadein
;<span style="color:grey;">fadein [deprecated]</span>
:<integer> Fade in time (0-100)
:<span style="color:grey;"><integer> Fade in time (0-100)</span>
;fadeout
;<span style="color:grey;">fadeout [deprecated]</span>
:<integer> Fade out time (0-100)
:<span style="color:grey;"><integer> Fade out time (0-100)</span>
;{{ep1 add|fadeinsecs}}
;{{ep1 add|fadeinsecs}}
:<integer> Fade in time (0-100). "fadein" deprecated
:<integer> Fade in time (0-100).
;{{ep1 add|fadeoutsecs}}
;{{ep1 add|fadeoutsecs}}
:<integer> Fade out time (0-100). "fadeout" deprecated
:<integer> Fade out time (0-100).
;pitch
;pitch
:<integer> Sound pitch, expressed as a range from 1 to 255, where 100 is the sound's default pitch.
:<integer> Sound pitch, expressed as a range from 1 to 255, where 100 is the sound's default pitch.
;pitchstart
;pitchstart
:<integer> Start pitch, expressed as a range from 1 to 255, where 100 is the sound's default pitch.
:<integer> Pitch to begin spinning up at.
;spinup
;spinup
:<integer> Spin up time (0-100)
:<integer> Spin up time (0-100). Analogous to ''fadeinsecs''.
;spindown
;spindown
:<integer> Spin down time (0-100)
:<integer> Spin down time (0-100). Analogous to ''fadeoutsecs''.
;lfotype
;lfotype
: <integer> [[LFO]] type
: <integer> [[LFO]] type
Line 105: Line 117:
| 2 || Triangle Wave (sharper transitions)
| 2 || Triangle Wave (sharper transitions)
|-
|-
| 3 || Sine Wave (smoother transitions)
| 3 || Random
|}
|}
;lforate
;lforate
:<integer> [[LFO]] rate (0-1000), how frequently the LFO effect repeats itself.
:<integer> [[LFO]] rate (0-1000), how frequently the LFO effect repeats itself. <!-- per second? -->
;lfomodpitch
;lfomodpitch
:<integer> [[LFO]] modulation pitch (0-100), affects the sound pitch or [http://en.wikipedia.org/wiki/Vibrato "vibrato"]. Higher numbers change the pitch more - singers use little, police sirens use a lot.
:<integer> [[LFO]] modulation pitch (0-100), affects the sound pitch or [http://en.wikipedia.org/wiki/Vibrato "vibrato"]. Higher numbers change the pitch more - singers use little, police sirens use a lot.
;lfomodvol
;lfomodvol
:<integer> [[LFO]] modulation volume (0-100), affects the volume of the sound, causing it to "pulse." Similar to [http://en.wikipedia.org/wiki/Tremolo "tremolo"].
:<integer> [[LFO]] modulation volume (0-100), affects the volume of the sound, causing it to "pulse." Similar to [http://en.wikipedia.org/wiki/Tremolo "tremolo"].
;cspinup
;cspinup ''(Incremental Spinup Count)''
:<integer> Incremental Spinup Count
:<integer> Appears to be a method for increasing pitch in time with ToggleSound inputs, but:
;radius
:{{bug|Non-functional.}}
;radius ''(Max Audible Distance)''
:<string> Maximum distance at which this sound is audible.
:<string> Maximum distance at which this sound is audible.
:{{bug|Non-functional.}}
;SourceEntityName
;SourceEntityName
:<target_destination> 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 a lipsynch exists for the sound, the target will lipsynch to it.
:<target_destination> 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 a lipsynch exists for the sound, the target will lipsynch to it.


== Flags ==
=== Flags ===
;1 - Play everywhere
;1 - Play everywhere
:The sound will play as if inside the players head, not depending on distance or direction to the playing entity.
:The sound will play as if inside the players head, not depending on distance or direction to the playing entity.
:{{bug|This flag '''is broken at engine level''' for [[Soundscripts]]. It will only work when a sound is played with its raw filename.}}
;16 - Start Silent
;16 - Start Silent
:The map will start with this sound not playing. To make a sound play from the start of the map, both this flag and the ''Is NOT Looped'' flag must be cleared.
:The map will start without this sound playing. Enabled by default.
:{{bug|Looping sounds that start enabled cannot be controlled!}}
;32 - Is NOT Looped
;32 - Is NOT Looped
:Used for sounds that aren't looped. The sound can be repeatedly played using continuous ''PlaySound'' inputs, but can not be turned off by the ''StopSound'' input. (Multiple sounds from the same entity will not overlap eachother, meaning that the previous sound will be automatically stopped by the next sound being played.) If not checked, a ''StopSound'' input is instead required to reset the sound before it can be played with another ''PlaySound'' input. This flag concerns ''PlaySound'' inputs only. ''Volume'' inputs are not affected.
: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 ==
=== Inputs ===
* {{i targetname}}
* {{i targetname}}


;Pitch <integer>
;Pitch <integer>
: Sets the sound pitch, expressed as a range from 1 to 255, where 100 is the sound's default pitch.
: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.}}
;PlaySound
;PlaySound
: Starts the sound (if a looped sound isn't already playing). Also registers a sound as playing for the ''StopSound'' input.
:Starts the sound.
;StopSound
;StopSound
: Stops the sound if it is looped, is playing, and has been registered as playing through the ''PlaySound'' input.
:Stops a looping sound.
:{{note|Does not stop a non-looping sound. This is intentional, and can be changed with C++.}}
;ToggleSound
;ToggleSound
: Toggles the sound between playing and stopping.
: Toggles a looping sound between playing and stopped. Behaves like ''PlaySound'' if the sound is unlooped.
;Volume <integer>
;Volume <integer>
: Plays the sound at the sound volume given, expressed as a range from 0 to 10, where 10 is the loudest. It will play the sound as a ''PlaySound'' input would, but will not register that the sound is playing, meaning that looped sounds started entirely through this input will not be able to be stopped with the ''StopSound'' input, and it will not be affected by the ''Is NOT Looped'' flag being unchecked. It is currently speculated that an unplayed sound being able to be played using only the ''Volume'' input, is a bug.
: 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.}}
;{{ep1 add|FadeIn <integer>}}
;{{ep1 add|FadeIn <integer>}}
:Fades the sound up to full volume over a specified number of seconds, with a range from 0 to 100 seconds.
:Fades the sound up to full volume over a specified number of seconds, with a range from 0 to 100 seconds.
:{{bug|Non-functional.}}
;{{ep1 add|FadeOut <integer>}}
;{{ep1 add|FadeOut <integer>}}
:Fades the sound to silence over a specified number of seconds, with a range from 0 to 100 seconds.
: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.}}


== Outputs ==
=== Outputs ===
* {{o targetname}}
* {{o targetname}}
== See also ==
* [[env_soundscape]] - an entity used for changing [[DSP]] settings and ambient [[Soundscapes|soundscapes]].
==External links==
* [http://www.slackiller.com/New%20Tuts/sound.html Setting up ambient_generics in Counter-Strike: Source using logic_auto] - a substitute for creating a proper env_soundscape.


[[Category:Entities]]
[[Category:Entities]]
[[Category:Sound System]]
[[Category:Sound System]]

Revision as of 08:47, 2 March 2008

Template:Wrongtitle

Ambient generic.png

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.

Icon-Bug.pngBug: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.pngNote: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.

See also

External links

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
<integer> 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)
Template:Ep1 add
<integer> Fade in time (0-100).
Template:Ep1 add
<integer> Fade out time (0-100).
pitch
<integer> Sound pitch, expressed as a range from 1 to 255, where 100 is the sound's default pitch.
pitchstart
<integer> Pitch to begin spinning up at.
spinup
<integer> Spin up time (0-100). Analogous to fadeinsecs.
spindown
<integer> Spin down time (0-100). Analogous to fadeoutsecs.
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
<integer> LFO rate (0-1000), how frequently the LFO effect repeats itself.
lfomodpitch
<integer> LFO modulation pitch (0-100), affects the sound pitch or "vibrato". Higher numbers change the pitch more - singers use little, police sirens use a lot.
lfomodvol
<integer> LFO modulation volume (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:
Icon-Bug.pngBug:Non-functional.  [todo tested in ?]
radius (Max Audible Distance)
<string> Maximum distance at which this sound is audible.
Icon-Bug.pngBug:Non-functional.  [todo tested in ?]
SourceEntityName
<target_destination> 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 a lipsynch exists for the sound, the target will lipsynch to it.

Flags

1 - Play everywhere
The sound will play as if inside the players head, not depending on distance or direction to the playing entity.
Icon-Bug.pngBug: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.
Icon-Bug.pngBug:Looping sounds that start enabled 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.
Icon-Bug.pngBug: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.pngNote: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.
Icon-Bug.pngBug: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 ?]
Template:Ep1 add
Fades the sound up to full volume over a specified number of seconds, with a range from 0 to 100 seconds.
Icon-Bug.pngBug:Non-functional.  [todo tested in ?]
Template:Ep1 add
Fades the sound to silence over a specified number of seconds, with a range from 0 to 100 seconds.
Icon-Bug.pngBug:Will bring the sound up to full volume (i.e. 10) before beginning to fade it.  [todo tested in ?]

Outputs