Talk:Ambient generic

From Valve Developer Community
Revision as of 15:31, 24 August 2009 by Tgp1994 (talk | contribs)

Jump to: navigation, search

Is it possible to stop a music MP3 playing? I've got a section of my map where if the player goes very quickly, they'll trigger the next track before the previous one has ended. Ideally, I'd fade the old one out and start the new one, but that doesn't appear to work - instead I get both playing simultaneously. Any ideas? --Cargo Cult 14:58, 29 Aug 2005 (PDT)

Found that the stopsound command does the trick, in a rather hacky manner - it stops everything playing. I've got a point_clientcommand to do this - a logic_relay timer counts down so that if the first music track finishes playing naturally, it disables the logic_relay thingy which would send the stopsound command. If that makes sense. The second, command-sending logic thingy also starts up the relevant soundscape and ambient sounds... --Cargo Cult 13:46, 30 Aug 2005 (PDT)
I know it's most likely too late, but wouldn't it be easier to just kill the entity? --Vaarscha 14:22, 19 Mar 2006 (PST)
FadeIn and FadeOut are in as of Episode One. --TomEdwards 12:29, 5 Aug 2006 (PDT)
My hacky way of stopping a sound - set the Volume to 0. Works like a charm. --Campaignjunkie (talk) 21:32, 10 Sep 2006 (PDT)
NONE of this seems to work for me. I even tried manually doing it using the ent_fire command. --Darthkillyou 19:11, 19 Apr 2007 (PDT)

Definition List

I've converted this article to use the Wiki's DL system, which simplifies markup considerably. There are a few minor problems:

  • The table breaks the list into three due to a Wiki limitation
  • Another Wiki limitation means that the Flags had to have their semicolons replaced with dashes
  • I couldn't convert the Template:I Targetname, as that would have messed up other articles

Nothing too major. What do people think? With some find/replacing (perhaps even at Valve's end) the conversion could be fairly quick. --TomEdwards 12:29, 5 Aug 2006 (PDT)

Personally I think it's a bit much to save a few bytes of bandwidth as I am happy with the current template—ts2do 12:42, 5 Aug 2006 (PDT)
In terms of reading the pages, I see no significant positives or negatives. In terms of editing the pages, I can see that it's simpler and easier to visually parse. However, the Input/Output/Flag listings are basically "finished" (in that I can't imagine any significant improvements in information content that could be made), excepting new entities.
Given that, (and given that the '''s straddle the word and so would require regular expressions to change automatically, instead of just simple find/replace?), I can't see the change being worthwhile in cost:benefit terms. But if you want to volunteer ... --Giles 12:55, 5 Aug 2006 (PDT)
You could catch them with the *''' pattern, but honestly I have no idea about regular expressions. --TomEdwards 13:06, 5 Aug 2006 (PDT)


In a map I'm currently working on, I need to play a sound and it must follow the object that is supposed to make this sound. After realizing that there's no "parent" property for this entity I tried to use the "SourceEntityName" one. Actually it works well in the way that the sound is following the object, but the problem is that the sound's volume has been lowered and can't be heard at all. You must put the player 30 units away from the ambient_generic to hear it properly. It's really strange because it's volume is set to 10 (the maximum) and if I delete the "SourceEntityName" field, the sound's volume reverts to normal.. Is there a way to have a sound following a moving entity without having to duplicate it 10 times in order to multiply the volume by 10 ? --NykO18

The only way i can think of is making the sound itself louder.


I have another problem: When I spawn a prop_physics via point_template and env_entity_maker, Source Entity Name set to the Template. But the Sound is only played where the Template is, even when I use the name fixup (also tried <entityname>&0000-&0002 for Source Entity Name). When the Template is removed, the ambient_generic plays the Sound where the ambient_generic is. Puchi 12:11, 4 Dec 2007 (PST)

I made a disco room with multiple func_walls named "speakers" to which I had an ambient_generic with the SourceEntityName set to the speakers. The outcome was only one of the func_walls had music coming from it and it was very low. I tried the same but instead of func_walls I used ambient_generics and this did not work. It seems this does option does not work properly. I was able to get what I wanted by adding more ambient_generics with the same name and same sound file playing at the same time. --MongoTheMad 17:08, 22 July 2009 (UTC)

Seems to me that you should try to find the name of the entity that's actually spawned. Try turning on developer mode and +using it: the name should appear in the console. --TomEdwards 17:22, 22 July 2009 (UTC)

Starting Silent

I've noticed that you cannot get this entity to actually start on map spawn - not automatically, on its own - making the Start Silent flag a mystery. ...or am I wrong? I can't hear anything at least. Can you? --Andreasen 18:32, 10 Sep 2006 (PDT)

In theory, having this flag off starts the sound automatically only if it's a looping sound. If this is not what you observe, (complete guess:) the problem may be because it is trying to start the sound before the player is in the map.—ts2do 19:36, 10 Sep 2006 (PDT)
I always thought it was to make the sound fade in rather than start playing at 100% immediately. --TomEdwards 02:13, 11 Sep 2006 (PDT)
If it is, you might want to go through the trouble of retesting the functions of the PlaySound, StopSound and Volume I/O, because I think those sounds were started silently when I tested them. --Andreasen 09:42, 11 Sep 2006 (PDT)
Researched it: The Is NOT Looped flag will cancel out the cleared Start Silent flag. Whether the sample itself is looped or not, you must always have the Is NOT Looped flag cleared for it to play at the beginning. --Andreasen 12:05, 11 Sep 2006 (PDT)

Which is sorta exactly what I said—ts2do 13:46, 11 Sep 2006 (PDT)

Yes, but now I've confirmed it too. :P ("In theory" sounded so vague.) --Andreasen 14:13, 11 Sep 2006 (PDT)

Needs clarifications

Descriptions like "<integer> Spin up time (0-100)" mean nothing. This page needs actual descriptions of what the different values do. Thelonesoldier 00:10, 5 Feb 2007 (PST)

Many of the entity descriptions on support pages are like this I had hoped this place would build up real descriptions to clarify more. This has been an ongoing problem since HL1 SantagausS 21:42, 16 Feb 2007 (PST)

Sounds not working on dedicated servers

I have noticed that sound scripts do not seem to work on dedicated servers only raw sounds will work? This happens in hl2dm on linux servers. Can anyone confirm this and if so I think I will add a note as it caused me to lose quite a bit of time screwing with it. SantagausS 21:42, 16 Feb 2007 (PST)

This is something to do with server and client soundscripts being different, IIRC. Most script sounds ought to work, unless you're doing them custom and not shipping your script along with the map. --TomEdwards 03:21, 17 Feb 2007 (PST)

Music Previews

Um... How do you preview music? I can preview .wav sounds but not any of the .mp3 (music) sounds. I hate having to go in-game to figure out how each music file sounds like. --Darthkillyou 18:49, 19 Apr 2007 (PDT)

GCFScapets2do 21:15, 19 Apr 2007 (PDT)
Thanks, sorry it took so long to reply. --Darthkillyou 16:11, 6 Jul 2007 (PDT)

Using ambient_generic (or any other means) to create a global ticking sound in Portal

I have a func_button with "Use Activates", to start a logic_relay to open a door, play a sound, and activate a timer_relay, of which drives an ambient_generic that plays the Portal ticking noise every second.

The ambient_generic is set with all three flags checked... but the sound still acts as if the "Play Everywhere" flag was not checked. What gives? And how else could I make the desired effect?--volt 02:33, 22 Nov 2007 (PST)

Instead use a logic_choreographed_scene.--Gear 04:02, 22 Nov 2007 (PST)

How to use the FadeIn input

Does someone ever managed to use this input ? I'd like to start a sound by rising its volume slowly, but it seems there's no way do to so. I tried almost everything, a WAV, a looping WAV, a MP3, FadeIn alone, PlaySound then FadeIn, Volume then FadeIn, PlaySound then Volume and FadeIn. Nothing works, the sound does not start or starts immediately. Surprisingly, the FadeOut input works like a charm.. --NykO18 14:49, 1 Mar 2008 (PST)

You're right, it's broken. The "Fade in time" keyvalue still works, at least. I've looked at the source code and it appears that fadein doesn't work because the sound has to be playing to fade in - and if you start it at full volume, there's no fading to do! I'll look into a fix, but there's all sorts of low-level maths in this code (sound.cpp ln601)... --TomEdwards 00:47, 2 Mar 2008 (PST)
I'm out of ideas. --TomEdwards 01:23, 2 Mar 2008 (PST)
Can't you try setting Volume at 0, starting the sound with FadeIn, and then setting Volume at the desired amount? Solokiller 04:11, 2 Mar 2008 (PST)
That's what I tried! --TomEdwards 05:12, 2 Mar 2008 (PST)

Sound sample rate

Hi there everyone, I was compressing a song to crappy sample rate, to give it the impression it was being played on a radio. It seems like the lowest bit rate (I think) .wav files support is 8KHz, (or apparently 8,000 something), so I chose that. But when I try to play the audio ingame, it says it's sample rate is not supported! So I'm just wondering if someone can clarify to me the supported range of sample rates.

44KHz and nothing else AFAIK. --TomEdwards 15:36, 3 August 2009 (UTC)
What a range that is :P If anyone else would like to add, please do.--Tgp1994 15:44, 3 August 2009 (UTC)

Lotsa bugs

Doesn't anyone think Valve should be doing something about all of these
Bug: s