I’m making an application where you can trigger loops/samples, but they will only start at the right moment (which can be defined by setting the bpm and quantizing). Basically, you could load a couple of loops in the same bpm and set the program to that bpm. When you select to start a certain loop, it will wait for the beginning of the measure (bar) and then start. It will then loop using fmod’s looping functions, so the other events should keep exactly in synch with that.
What would be the best way to have this background bpm synching work? Is the Visual Basic timer control reliable enough? I could calculate the amount of miliseconds it should wait based on the bpm and use that as a reference but I’m not sure it is accurate enough. I’m concerned because when you select, for instance, 156 bpm, it would need to retrigger a sound every 384,61538461538461538461538461538 miliseconds to get an event to happen every beat, but I’m afraid it will take 384.
I could also program an infinite loop that constantly checks wheter enough time has passed and trigger my events then. This will also snap to milliseconds because I can’t check anything smaller than that, but I could still keep the floating point part so it’s not lost, if you understand.
Anyway, this post is way too long, but I’m hoping that someone will be able to give me some advice.
- fall asked 13 years ago
Yeah I just copy-pasted that number from within the windows calculator
I know that triggering a sound should not be that precise, but after 200 bars or something, it might just become important.
I mean, suppose you have fmod looping one track, and it loops for 200 bars. My synch routine should still be in synch after that. It’s not important that every sound is triggered that precisely, but it does become important after a large number of bars. Hope this makes sense.
I already made my own routine for this, but if I find that it’s not accurate enough, I’ll take your advise. Thanks.
- fall answered 13 years ago
The standard VB timer is not reliable for what you want to do; but much better timers have been developed and are readily available. Just do an internet search for “VB high resolution timer.” Keep in mind, however, that the local system will determine the timer’s precision (because all these timers rely on clock ticks).
Speaking of precision: The number of decimal places you suggested is absurd. The human auditory system has it own temporal resolution, which is in the order of milliseconds. NASA may need to be concerned with 30 decimal places, but you do not.
- Anonymous answered 13 years ago
Please login first to submit.