KF Music Loops

  • Please make sure you are familiar with the forum rules. You can find them here: https://forums.tripwireinteractive.com/index.php?threads/forum-rules.2334636/

NumberZero

Member
May 14, 2013
70
0
6
28
Hi all,

I'm wondering how to correctly loop music in Killing Floor. My setup is this:
1. I have a fade in track that is the intro to the main music
2. The main music that is looped for about 10 seconds, over and over
3. a fade out track that ends the loop
I understand that this is hard to comprehend. Basically

Fade in > Loop > Fade out
All 3 tracks are separate from one another.

I want to change the music to the 'Loop' track right after the 'Fade in'. No pauses or anything, or it'll take away from the game. I've tried to time it, but due to lag on some PC's, this isn't a surefire way to go about this. Is there a way I can change the music ONLY after the track is finished playing?
So I've been doing this:
<WAITFOREVENT>
<Event = "BeginMusic">
<PLAYMUSIC>
<Music = "ExampleFadeIn.ogg">
<Instant>
<WAITFORTIMER>
<17>
<PLAYMUSIC>
<MUSIC = "ExampleLOOP.ogg">
<WAITFOREVENT>
<Event = "MusicFadeOut">
<PLAYMUSIC>
<MUSIC = "ExampleFadeOut">

This is so rough and I hope I asked this is a way people will understand. If you'd like, I could post the tracks themselves so you can get a much better understanding of what I mean.

Thanks.
 

Marco

Active member
May 23, 2009
644
232
43
Finland
Well even the Unreal Engine 2 music player functions have a random delay within them. I noticed this with my beat block stage where I tried to sync music with a timer in level, but soon to realize it was impossible to get it to 100 % in sync, there were a random +/-1 second delay.
 

zYnthetic

FNG / Fresh Meat
Mar 20, 2009
1,071
168
0
Atlanta-ish
www.zynthetic.com
iirc, KF (base UE2 in general) only supports a single stereo ogg music stream. This rules out crossfades. In all media players (not just this game) software decoding introduces latency so there will be some milliseconds of delay transitioning to a new song while the stream is buffering for playback. The engine would need support for multiple streams (like UE3) for crossfades or gapless playback and a timing system (like Fmod, Wwise) derived from audio length rather than tick for synchronization between multiple segments to create uninterrupted transitions.