Best way to sync events w/ music?

  • I'm wondering what the best way to sync events with music is. Normally I just use "compare time" or I constantly add n*dt to a value and use that but it would seem, every now and then and most likely due to load times or something, that the music and events get out of sync. I wait until all audio is pre-loaded before starting the game, though..so hm. Anything else I could be doing?

  • With audio support as it is, there's probably not much you can do. Perhaps there's something in the Web Audio API, but I'm not sure.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Are you looking for a one-time synced event, or for an event to happen multiple times in time with music?

  • Hmm. I guess imagine Tom & Jerry and how the music is synced with their movements, just on a MUCH smaller scale.

    Say there's a scene when the music smoothly transitions from happy to sad, and something in the game reflects that - or maybe a song is playing through the intro and it only goes to the title screen when the song 'kicks off' - all that has to be perfectly in sync or it will look bad / cause upcoming events to be out of sync as well.

    Tracking down the milliseconds and executing the right event(s) based on that seems to be the only thing I can do, and it works pretty well provided there are no lag spikes / slow load times or something...but they are inevitable it seems.

  • Wouldn't be it cool, if there would be a midi-engine playing midi files and also trigger events based on the midi-file?!?

    ....just dreaming.....

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