I am attempting to create a side scrolling shooter prototype in which the actions of the enemies and bullets are timed to a beat. The target bpm I am working towards is 120.
At the centre of this is obviously the timing of the sounds and I have begun by trying to create a metronome as a guide. I use the getTimer function to calculate the frame time and accumulate this value until it reaches the right time (500ms for 120bpm), then playing a sound.
As you can imagine, this doesn't give a constant result and suggests that's there is a better option. So my question is what is the most accurate method to time sounds for a game of this type? Is this a problem solely with the timing? I am using Haxe NME, could i be too far removed from the audio device to play sounds fast enough?