Beat Syncing

Published March 30, 2011
Advertisement
Thanks to FreeSound.org I have a techno-ish track composed of separate melody and drum tracks. I also have a single kick-drum hit that I trigger when moving through and selecting menu items. The request to play the kick is queued, and it's played on the beat or half-beat. It almost works.

There are a couple problems:

One: the sound is queued, but the menu highlight occurs immediately. I'd hoped that sound triggers on beats and half-beats would be fast enough for it to mesh with menu traversal, but it just doesn't work out that way. I'm going to need to delay menu response to sync it to the beat as well. I wasn't counting on having to sync the menu. I think the best way to approach this is to expand the timer class to emit a beat signal, and have both the menu and audio systems (and possibly others) trigger their queued actions on that signal.

Two: Pressing the up or down arrow, or Enter to select a menu option, right on the beat (or as close to it as I can humanly get) should trigger the sound immediately. Instead, it seems to be just missing the beat, and waiting until the next beat trigger to play. I'm not sure how to solve this. I'm thinking of testing to see if I'm within the first XXX milliseconds (I'm thinking maybe fifty or so) after the beat, and playing the sound with an offset of however much time has elapsed since the last beat. This will require finesse if it works at all. Too small a window will be ineffective, and too large a window will cut off too much of the sound to sound good. I guess the only way to see if there's a window length that won't cause either issue is to implement it and try it out.

So that's what I've been working on today.

Oh, yeah. My eye surgery went well. As I expected, the anticipation was far worse than the event, but that didn't make it any easier. Now that I've been through it once, I won't mind much if/when I need to do it again; knowledge dissipates fear. Honestly, dealing with the bandage for a day was the worst part. There is no longer any blood in my eye obstructing my vision. It's hazy (think looking through a petroleum-jelly--smeared lens), but that's typical after eye surgery, and my vision is improving daily. It should be back to where it was before the hemorrhage in a couple weeks.
Previous Entry New Video: Camera Fix
0 likes 3 comments

Comments

yckx
After thinking about this some more (and adding libsigc++ so I could add signals to the timer, which I've just implemented), I believe that solving the first issue will obviate the second. It won't matter so much if menu response is delayed slightly to occur on the beat, and in-game, I think the proper design of sound effects will minimize the discontinuity of them not playing until the next eighth note. If I tweak the player speed to match well with the 140bpm music, it shouldn't be too bad, anyway. (I hope.)
March 30, 2011 05:52 AM
Gaiiden
can you not edit your journal entry after posting?
March 30, 2011 01:12 PM
yckx
Yes, it appears that I can. But it was nearly 3 A.M., and I was weary and bleary-eyed (as I so often am when posting here), and the Add Comment button is more obvious than the Options/Edit Entry button, so that's what I used ;)
March 30, 2011 03:16 PM
You must log in to join the conversation.
Don't have a GameDev.net account? Sign up!
Profile
Author
Advertisement
Advertisement