Hi there,
Working on a simple metronome app. Here’s our “ticking” function:
local function ticking() function tick() beat = audio.play( beat1 ) transition.to( stick, { rotation=-45, time=60000/dialNum, onComplete = tock} ) end function tock() beat = audio.play( beat1 ) transition.to( stick, { rotation=45, time=60000/dialNum, onComplete = tick} ) end transition.to (stick, { rotation= -45, time=30000/dialNum, onComplete = tock} ) end
The idea is, when this function is called, a stick object will rotate to 45 degrees and back with a “beat” sound playing on every pass. “dialNum” represents “beats per minute.” So if dialNum is set to 100, then there should be 100 beats per minute.
When we compared this to several online metronomes however, our Metronome was audibly off on its count (and you can imagine how that would be problematic). We can’t figure out why this would be the case, is there a problem with how Corona tracks seconds? Or is there something wrong with our math?
Thanks for taking a look at this.