Using Audio Context to sync hype timeline

Hey guys,

This is a feature request as much as it is some assistance request,
I’ve done a bunch of audio experiments recently trying to make audio work with mobile osx’s on rules and i wanted to port it over to Hype.

I tried to create a script which would load the audio then play the timeline synced perfectly to the audio timing. It does work right now but
-reseting the audio context requires scene swaps

  • it behaves strangely on android, it skips the first 3 or so seconds
    @jonathan is it somehow reacting strangely because it can’t mix with hype’s timeline?
    On iOS though it’s smooth as butter, check it out and let me know how I can optimise it or modify it so that it can sync even better!
    HypeAudio.zip (27.1 KB)

Currently you can set fps , link audio from library if you’d like and all animations are timed to the audio track fine.
Thanks!

1 Like

Your animation made me laugh with glee when I saw it for the first time :slight_smile:!

Well, you do reset the context on scene load, but I assume you are looking to avoid the showSceneNamed call. It does appear that you can replay the audio, but your callback isn't being called correctly. Try adding a console.log("timelineTime = " + timelineTime); to the else condition in drawStatic() and you'll see that it isn't being called with the times. You should be able to drive Hype just fine if these values were correct. My guess is that it is some sort of issue in the bufferloader.js code. Of course, you could always reset without reloading the scene, but you'd need to move code around so that was done on the button press.

I'm not sure what is going on here; it appears the audio context is giving a later time that what is really being played. Might be an android/chrome bug.

Thanks Jonathan!
The problem and why i used a different scene is context.currentTime continunues on, it doesn’t restart with the audio, so on a second play it goes past the duration and keeps playing. Resetting the scene seems resets the context.
I tried to suspend the context but in doing so i void the script, also from what chrome debugger tells me context calls have a limit of 6. I’m afraid i’m still intermediate with the html5 audioContext method of controlling audio, so if and when i find a more basic work around I’ll let you know.

But yeah I would love to be able to do what I’m doing now without the script and have the audio sync perfectly with the timeline for a lot of things(audio animation, lip sync etc) at some point in the future with an audio visual layer like in adobe animate!

1 Like

Hi Lucky!


In the interim You might find this thread interesting (as well as other ones referenced in the thread) if You haven't already seen it:
1 Like