Thanks for reading.
I am developing an app for musician right now, which requires being real accurate about the Beat Per Minute. I already finished most part of my code but sadly I find out the timing is not accurate in both simulater and Iphone during the test run.
After testing with two different professional metronome, the result is the speed in program is much slower. (You will not notice the difference during the first few bars, but after 20 sec, it turns out significantly.) In order to get a right beat while BPM=120, I changed the minute to 58080 instead of 60000. But with different BPM, the minute has to be set to different number to be accurate:
minute=58560 for BPM= 80,
minute=56880 for BPM=240,
So my questions are:
1.Do you think if coding this app with more function will make it even slower?
2.Are there any other ways to code it instead of performWithDelay or getTimer to make it accurate?
[code]BPM = 120
minute = 60000
beatT = minute / BPM
sound1 = audio.loadSound(“rde1.wav”)
timer.performWithDelay(beatT, function(event) audio.play(sound1) end, 0)
or
sound1 = audio.loadSound(“rde1.wav”)
curtime = 0
local function realtimer (event)
if system.getTimer() - curtime >= 500 then
audio.play(sound1)
curtime = system.getTimer()
end
end
timer.performWithDelay(1, realtimer, 0)
[import]uid: 81853 topic_id: 13802 reply_id: 313802[/import]