How do I make music finish before stopping playback?

Avatar
portal2companioncube
108 Posts
Posted May 14, 2014
I want to have music in my map change over time with some triggers. However, I want the previous track to finish before the next track starts. I have several ambient_generics to play the music, but how do I get one to finish playback before stopping and the new one to start when the previous one finishes? I thought of doing delays, but different players go through the map at different speeds. What should I do?
Advertisement
Registered users don't see ads! Register now!
Avatar
TeamSpen210
608 Posts
Posted May 14, 2014
Replied 29 minutes later
Making/editing the soundscript for the music could help do want you want to do (not sure how you want the music to change.) Valve uses it to synchronise things like the multi-part laser music tracks, the gel music tracks with the main track and things like that. Are the different tracks entirely separate songs, or parts/variations of one track?
Avatar
josepezdj
2,386 Posts
Posted May 15, 2014
Replied 6 hours later

@portal2companioncube: Apart from the soundscapes' operator_stacks that TeamSpen mentioned which are pretty complex, you could try to mount a system based in several ambient_generics and to fade them in and out.

Via some triggers, you can fire the FadeOut output to the first ambient_generic that is playing music. Don't forget to add a number of seconds in the 'With a parameter override of' output dialog box for the output to work out

Then use the FadeIn output on the 2nd ambient_generic to be played.... and so on. Go changing the number of seconds for each fade in-out in order to create a good transition between the 2 music tracks, avoiding any silence gap between them.

(Remember that you also have the Fade in and out properties into your ambient_generics where you can also set them to smooth the start/stop of yourr sound file)

Two Tips:

  1. In order to cut out completely each music track, remember to add these 2 outputs to the triggers for each of the sounds played after you know the fade out has ended up:

- OnTrigger > [ambient_generic_name] > Volume 0
- OnTrigger > [ambient_generic_name] > StopSound

  1. Remember to:

  2. Tick the flag "Play everywhere" on your ambient_generics in the case you want them to be the main music sound.

  3. Untick the flag "Is NOT looped" in order to make your sound to resume playing after a quickload/loadgame.