• entries
    59
  • comments
    74
  • views
    44065

Beat Syncing

Sign in to follow this  

348 views

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.
Sign in to follow this  


3 Comments


Recommended Comments

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.)

Share this comment


Link to comment
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 ;)

Share this comment


Link to comment

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now