Layered music
So... how do I do that? The wiki doesn't even mention this aspect of the game at all. Are the layers seperate sound files that have to be synchronized somehow? browsing sound files in Hammer is something of an incomplete mess (most of them won't even play?). Is it super-complicated and something I shouldn't even attempt until I have a dozen finished maps under my belt? Or is it something I can set up easily?
Although they may not be perfectly synched together, using triggers and ambient generics could get close enough as the songs would be in the same key and tempo. I know it's not exactly what you want to do but it's about as much help as I can offer. I'll ask some friends who are much better versed in Hammer how Valve does it exactly and get back to you.
How they made the music add different layers is probably by triggering a different sound altogether (stopping the other one that was playing), or its even part of the sound. The FadeIn and FadeOut values in an Ambient generic would be a great way to blend music together but I highly doubt they did that.
chickenmobile wrote:
How they made the music add different layers is probably by triggering a different sound altogether (stopping the other one that was playing), or its even part of the sound. The FadeIn and FadeOut values in an Ambient generic would be a great way to blend music together but I highly doubt they did that.
Yeah, I took this approach on my map since I had a bit of a crunch to get it polished up for the contest and didn't have time to sort out how Valve did it officially.
There are four looped ambient_generics in the map each set to a different sound file under /music/. They each have different values for the "Fade In" and "Fade Out" keys.
I'll save you a bit of head-scratching that I went through: although you are able to set 'FadeIn' and 'FadeOut' as inputs via I/O to an ambient_generic, they are non-functional!
The first ambient is triggered by a logic_auto with OnMapSpawn -> PlaySound
The remaining three each have a corresponding logic_relay with two outputs:
OnTrigger -> [new ambient_generic targetname] -> PlaySound
OnTrigger -> [old ambient_generic targetname] -> StopSound
With the appropriate keyvalues in "Fade In" and "Fade Out" the new sound comes in gradually and the old fades out to 'blend' them a bit. Each of the logic_relays are fired off as the player progresses or test elements are completed.
Seemed to work here, but I'd like to look into the 'official' method for my next map. I was also somewhat surprised that Portal2 does not have the ambient_music entity that's apparently available in L4D. Odd, I'd think this is exactly what you'd want to use but oh well.
Another caveat: I haven't tested it myself, but offhand I don't think that this method with ambient_generics set with a /music/ file actually plays through the Music channel (where you can increase/decrease Music Volume separately from Game Volume in the options).