Loop to certain point in a music track

0 favourites
  • 3 posts
From the Asset Store
Connect the dots in the correct order and draw happy animals!
  • A while back I made a thread about looping music tracks with intros that should only play once. The consensus was to use 2 different tracks and one of many ways to decide when one has finished and the other should start (taking the tag which I need to use elsewhere..) I'm pretty sure I tried them all and ended up with a slight pause or gap in-between the two every time.

    That said, is it possible to add an extra parameter to the "play audio" dialog that tells the music track what time to loop back to? Even if it can be done with 2 tracks, this would be much easier.

    While we're on the subject, is it possible to allow additional tags like the function parameters?

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • +1, this would be really awesome to have. Even back in the Megaman days on NES, they had short little unique intros before the whole track played and would just continue to loop from there. It was subtle, sure, but it made a hell of a difference and set MM's BGM apart from the rest.

  • Yes. There is an Audio property for playback time. You can reference it with Audio.PlaybackTime("Whatever") and then you can alter it with Audio > Seek To.

    It's a little tough to make it perfect, though. There are a few ways I've gotten around it, though.

    Firstly, you'll need to say if Audio.PlaybackTime("Whatever") is > or = to ~~~, Seek To ---. This is the quick and dirty and accounts for if it happens to be off by a millisecond or several when the processing tick goes by. You can also reference on track ended, but this is unreliable in my experience (it works, just introduces gaps).

    You can also play the same track over itself once it ends by alternating tags. Ie if Audio.Audio.PlaybackTime("Whatever1") >= to ~~~, play with tag "Whatever2". And then alternate events. This way, you can retain the audio spill-over at the end of the measure without wrapping it to the start of the track (or the mid-point wherever you are going with it). It isn't an ideal solution, but it works.

    Or you could do the whole things split up by measures on a timer and make it fully interactive...

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