This article's documentation is for the "GoldSrc" engine. Click here for more information.

Ambient generic (GoldSrc): Difference between revisions

From Valve Developer Community
Jump to navigation Jump to search
(Added all keyvalues, flags and info. Removed stub tag.)
mNo edit summary
 
(40 intermediate revisions by 11 users not shown)
Line 1: Line 1:
{{GoldSource base point|ambient_generic}}
{{LanguageBar}}
{{gldsrc topicon}}


==Description==
{{tabs|Ambient generic|goldsrc = 1|source = 1|main = source}}
An ambient_Generic is essentially an audio player, that plays a ''single'' specified sound within a given radius inside a map. Ambient_generics are used to create sound effects throughout a map, either playing the sound ''once'', or continually repeating the sound (''looping''). <code>ambient_generic</code> audio comes from WAV files located in the games' ''Sound'' file directory. '''Example:''' ''\Half-Life\Valve\Sound\Barney\Hello.WAV''


==Key Values==
{{CD|CAmbientGeneric|goldsrc=1}}
{{this is a|point entity|name=ambient_generic|engine=GoldSrc|sprite=1}}
 
It is essentially an audio player that plays a ''single'' specified sound within a given radius inside a map. Ambient_generics are used to create sound effects throughout a map, either playing the sound ''once'', or continually repeating the sound (''looping''). <code>ambient_generic</code> audio comes from [[WAV]] files located in the game's ''Sound'' file directory. '''Example:''' {{file|Half-Life\valve\sound\barney\hello|wav}}.
 
{{Important|If using custom ''looping'' WAV files, cue points need to be added at the ends of the desired segment or the audio will not play!<br>See also: [[Looping a Sound]]}}
 
If multiple ambient generics with the same sound are played
 
== Key Values ==
{{Hl1 kv targetname}}
{{Hl1 kv targetname}}
{{ScrollBox|title=Universal Ambient|
{{KV|WAV Name|intn=message|sound|The file name of the sound to play (relative to the mod/sound folder, i.e. <code>ambience/techamb1.wav</code>), or a [[sentences.txt|sentence]] (if prefixed with <code>!</code>, i.e. <code>!HG_ALERT1)</code>).<br>Prefix the name (not the path!{{confirm}}) with a <code>*</code> if the sound should be streamed (i.e. <code>ambience/*speak2.wav</code>); streamed sounds will not be cached.}}
; WAV Name <code><[[sound]]></code>
{{KV|Volume|intn=health|integer|A number between 1 and 10. The sound emitted will be scaled by this number where 10 is the loudest and 1 is almost completely silent.}}
: The file name of the sound to play. Relative to the mod/sound folder, for instance: <code>anbience/techamb1.wav</code>
{{KV|Dynamic Presets|intn=preset|choices|
; Volume <code><[[integer]]></code>
: A number between 1 and 10. The sound emitted will be scaled by this number where 10 is the loudest and 1 is almost completely silent.
; Dynamic Presets <code><choices></code>
: Modifies the sound with various effects and reverbs.
: Modifies the sound with various effects and reverbs.
:* 0 : "None"
:* 0 : "None"
Line 41: Line 47:
:* 26 : "Planet X"
:* 26 : "Planet X"
:* 27 : "Haunted"
:* 27 : "Haunted"
; Start Volume <code><integer></code>
}}
: The volume to start a fade in at if fadein time is specified.
{{KV|Start Volume|intn=volstart|integer|The volume to start a fade in at if fadein time is specified.}}
; Fade in time <code><integer></code>
{{KV|Fade in time|intn=fadein|integer|Time to fully fade from start volume to volume.}}
: Time to fully fade from start volume to volume.
{{KV|Fade out time|intn=fadeout|integer|Time to fully fade from volume to start volume.}}
; Fade out time <code><integer></code>
{{KV|Pitch|intn=pitch|integer|A number from 1-255 that modifies the pitch of the sound where 100 is normal pitch.}}
: Time to fully fade from volume to start volume.
{{KV|Start Pitch|intn=pitchstart|integer|The pitch to start a fade in at if fadein time is specified.}}
; Pitch <code><integer></code>
{{KV|Spin up time|intn=spinup|integer|The time it takes for each incremental spinup if specified to be used.}}
: A number from 1-255 that modifies the pitch of the sound where 100 is normal pitch.
{{KV|Spin down time|intn=spindown|integer|The time it takes for each incremental spindown if specified to be used.}}
; Start Pitch <code><integer></code>
{{KV|LFO type|intn=lfotype|integer|
: The pitch to start a fade in at if fadein time is specified.
Type of [[LFO|Low Frequency Oscillation]] to employ.
; Spin up time <code><integer></code>
:# off (default)
: The time it takes for each incremental spinup if specified to be used.
:# square (alternate between low and high)
; Spin down time <code><integer></code>
:# tri (crossfade between high and low)
: The time it takes for each incremental spindown if specified to be used.
:# random
; LFO type <code><integer></code>
}}
: 0)off 1)sqr 2)tri 3)rnd {{todo|Explain what this does.}}
{{KV|LFO rate|intn=lforate|integer|How frequently the LFO effect repeats itself.}}
; LFO rate <code><integer></code>
{{KV|LFO mod pitch|intn=lfomodpitch|integer|Affects the sound pitch or [[Wikipedia:vibrato|vibrato]]. Higher numbers change the pitch more - warbling singers use little, police sirens use a lot.}}
: {{todo|Add description}}
{{KV|LFO mod vol|intn=lfomodvol|integer|Affects the volume of the sound, causing it to "pulse." Similar to [[Wikipedia:tremolo|tremolo]]. At a really high rate, this can make the same effect as talking through fan blades.}}
; LFO mod pitch <code><integer></code>
{{KV|Incremental spinup count|intn=cspinup|integer|The amount of incremental spinups to do if specified to be used.}}
: {{todo|Add description}}
; LFO mod vol <code><integer></code>
: {{todo|Add description}}
; Incremental spinup count <code><integer></code>
: The amount of incremental spinups to do if specified to be used.}}


==Flags==
== Flags ==
* 1 : "Play Everywhere"
* 1 : "Play Everywhere"
:: {{modernImportant|This does '''not''' disable directionality, only attenuation! To simulate disabled directionality without a custom audio backend, place three or four identical ambient_generic entities in the far corners of the map.}}
* 2 : "Small Radius"
* 2 : "Small Radius"
* 4 : "Medium Radius"
* 4 : "Medium Radius"
Line 73: Line 75:
* 16 : "Start Silent"
* 16 : "Start Silent"
* 32 : "Not Toggled"
* 32 : "Not Toggled"
 
:: Enable this flag for non-looping sounds. Older FGDs will have "Is Not Looped" instead.
==See also==
[[Category:Entities]]
[[ambient_generic]] (Source Engine)
<!-- [[Category:Half-Life Entities]] disabled see if entity template fix works -->
 
[[Category:GoldSrc Sound System]]
[[Category:Half-Life]][[Category:Half-Life Entities|A]][[Category:Entities]]

Latest revision as of 04:38, 21 August 2025

English (en)Русский (ru)Translate (Translate)

C++ Class hierarchy
CAmbientGeneric
CBaseEntity
C++ sound.cpp
Ambient generic.png

ambient_generic is a point entity available in all GoldSrc GoldSrc games.

It is essentially an audio player that plays a single specified sound within a given radius inside a map. Ambient_generics are used to create sound effects throughout a map, either playing the sound once, or continually repeating the sound (looping). ambient_generic audio comes from WAV files located in the game's Sound file directory. Example: 🖿Half-Life\valve\sound\barney\hello.wav.

Icon-Important.pngImportant:If using custom looping WAV files, cue points need to be added at the ends of the desired segment or the audio will not play!
See also: Looping a Sound

If multiple ambient generics with the same sound are played

Key Values

Name (targetname) <string>
The targetname that other entities refer to this entity by.
WAV Name (message) <sound>
The file name of the sound to play (relative to the mod/sound folder, i.e. ambience/techamb1.wav), or a sentence (if prefixed with !, i.e. !HG_ALERT1)).
Prefix the name (not the path![confirm]) with a * if the sound should be streamed (i.e. ambience/*speak2.wav); streamed sounds will not be cached.
Volume (health) <integer>
A number between 1 and 10. The sound emitted will be scaled by this number where 10 is the loudest and 1 is almost completely silent.
Dynamic Presets (preset) <choices>
Modifies the sound with various effects and reverbs.
  • 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"
Start Volume (volstart) <integer>
The volume to start a fade in at if fadein time is specified.
Fade in time (fadein) <integer>
Time to fully fade from start volume to volume.
Fade out time (fadeout) <integer>
Time to fully fade from volume to start volume.
Pitch (pitch) <integer>
A number from 1-255 that modifies the pitch of the sound where 100 is normal pitch.
Start Pitch (pitchstart) <integer>
The pitch to start a fade in at if fadein time is specified.
Spin up time (spinup) <integer>
The time it takes for each incremental spinup if specified to be used.
Spin down time (spindown) <integer>
The time it takes for each incremental spindown if specified to be used.
LFO type (lfotype) <integer>
Type of Low Frequency Oscillation to employ.
  1. off (default)
  2. square (alternate between low and high)
  3. tri (crossfade between high and low)
  4. random
LFO rate (lforate) <integer>
How frequently the LFO effect repeats itself.
LFO mod pitch (lfomodpitch) <integer>
Affects the sound pitch or vibrato. Higher numbers change the pitch more - warbling singers use little, police sirens use a lot.
LFO mod vol (lfomodvol) <integer>
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 (cspinup) <integer>
The amount of incremental spinups to do if specified to be used.

Flags

  • 1 : "Play Everywhere"
Icon-Important.pngImportant:This does not disable directionality, only attenuation! To simulate disabled directionality without a custom audio backend, place three or four identical ambient_generic entities in the far corners of the map.
  • 2 : "Small Radius"
  • 4 : "Medium Radius"
  • 8 : "Large Radius"
  • 16 : "Start Silent"
  • 32 : "Not Toggled"
Enable this flag for non-looping sounds. Older FGDs will have "Is Not Looped" instead.