Hi All,
I’m looking to make a drum machine app on the ipad 2.
I’m triggering drum hits (wav files under 20k) in a sequence using timer.performWithDelay but am experiencing inconsistent timing on the actual device (timing is perfect in the simulator).
My understanding is that audio.loadSound will fully load the sample into memory thus enabling immediate playback when needed.
I’m guessing the audio trigger is causing the irregular lag but could it be that the timer itself varies in speed? is it framerate or system timer dependent?
I’m wondering if there are any tricks for a super stable timer or a way to trigger audio faster.
Here is a simplified version of the code I’m currently using:
[code]kick = audio.loadSound(“bd.wav”)
local sequencer = function(event)
if(play==1) then
Channel,BD = audio.play(kick, {channel=1,loops = 0})
end
end
seqTimer = timer.performWithDelay(100,sequencer ,-1)
[/code]
Thanks in advance for any tips!
Alex [import]uid: 66618 topic_id: 20420 reply_id: 320420[/import]
Then we wait for the calculated time of the next beat to pass, and trigger it.

[import]uid: 66618 topic_id: 20420 reply_id: 85337[/import]