How do I make a looped song fade back in to itself?

0 favourites
  • 7 posts
From the Asset Store
Helping streamers give their viewers more excitement.
  • I have some menu music for my game that is supposed to loop infinitely. The thing is, I need it to loop seamlessly so the last beat fades in to the first beat when it loops back around.

    I've tried searching the forums but most people asking similar questions want to know how to fade one song into a different song, rather than one looped song.

    Ideally I'd like to re-start the song right on the final beat, and have the final beat begin fading at that moment.

    How do I achieve this?

  • If you remove any silence from the beginning and the end of the audio file and play it with Loop=on setting, it should loop seamlessly.

  • In order to have it loop in time with the beat (so the last beat of the song goes right back in to the first beat) I would have to cut off the final notes ringing out though. It would sound too abrupt.

    If I let the note ring out, there will be a gap in the music when it loops (even if I cut off the silence when the note is finished ringing out).

    I need the last note to ring out over the first note when it loops.

  • Try Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Try Now Construct 3 users don't see these ads
  • I understand that you need a small overlap. But I think it's easier to do in a sound editor. Mix the beginning notes into the end of the track, and the ending notes into the beginning. And crop it so that it plays seamlessly.

    If you want to do it in Construct, you'll have to play the first copy of the song, and then compare AudioPlaybacktime expression on every tick. When it's almost the end of the song, start the second playback and fade out the first.. I don't know how accurate this will be.

  • I understand that you need a small overlap. But I think it's easier to do in a sound editor. Mix the beginning notes into the end of the track, and the ending notes into the beginning. And crop it so that it plays seamlessly.

    If you want to do it in Construct, you'll have to play the first copy of the song, and then compare AudioPlaybacktime expression on every tick. When it's almost the end of the song, start the second playback and fade out the first.. I don't know how accurate this will be.

    Thanks! I'm trying the second method but I can't get it to work. To test it out I'm doing "System > Compare two values > Audio.Playbacktime('Music') = 5" and then playing another file as the action. (Instead of "5" I've been trying different values because I have no idea if it counts in seconds or milliseconds, etc.) "Music" is the tag I've tagged my music with for now.

    The second sound file never plays though, no matter what I set the number value to or how long I wait.

    Another thing that might be affecting it is that I have the music in the Sounds folder, because it won't start playing otherwise (this is something I've read about on the forums).

  • Playbacktime should be in seconds, and it will almost never be equal to exactly 5. So you should use this:

    Audio.Playbacktime("Music")>=5
    Trigger once
    	Audio play "Music"
    
  • Thank you!

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)