For fun, I've built a simple simulation of a drum machine in JavaScript. (You can try it at http://mink.click .)
I'm wondering if there's anything I can do to improve the accuracy of setInterval(...). In a perfect world, a sample would fire every 250 ms (until I make it customizable). But (a) running code stops it from being a perfect world, because it takes time to execute each instruction, and (b) sometimes, when I've just started playing, the firing of the timer (in Chrome) seems to take longer.
I know that in Windows, you can set a multimedia timer that's more accurate than the typical WM_TIMER messages, which use the message queue. So, I'm wondering if there's any way of getting a more accurate timer in JavaScript.
I know JavaScript isn't the best place to build a drum machine simulator, but I'm just doing it for fun :-)