Track position in looped audio with reduced playback rate?

0 favourites
  • 4 posts
From the Asset Store
Simple and easily editable template for a dynamic camera that zooms in and out based on how far apart the players are.
  • Howdy,

    I'm playing an audio track and I have it set to looping. Over the life-cycle of the audio track I also change the audio playback rate at different points.

    I need to find out my position in the track during any given loop. I don't think I can use the system PlaybackTime because this just shows the amount of time since the start of the loop. Does anyone have any suggestions on how to achieve this?

    Any help would be most appreciated,

    Thanks

  • just a thought......if you set your audio track to not looping?

  • korbaach, thanks for the suggestion.

    I have already tried setting the track to not looping and then restarting it every time it finishes. Unfortunately (on PhoneGap) there's an obvious gap between the end of one track and the start of the next one.

    I need seamless looping for the project I'm working on. So I have to find a way to work out how far I am through the track, while it's looping.

    Thanks anyway.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Hi again,

    I've managed to work out that you can measure your position in a looping audio tack by using modulo. The formula is Audio.PlaybackTime % Audio.Duration.

    This works well at a normal playback rate. But I need to reduce tempo of the audio track over time (by changing the playback rate). And unfortunately, as I change the playback rate, it seems to throw the calculation off.

    Can any of the maths geniuses out there, provide any ideas on how I can incorporate a changing playback rate into the formula. My rate goes down by a set amount every second until it reaches the desired goal.

    Thanks for any advice you can offer

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