I'm currently facing the task of programming an app (IOS and Android) where one feature will be a metronome for drummers.
I do not want to have multiple projects so i decided to use cordova. I stumbled upon many problems and solved some of them:
So i came across the Web Audio API which is not supported by the Android Stock browser on most platforms so i found the crosswalk project which is ment to support the Web Audio API.
The good news is that my metronome test works great on a chrome browser on Desktop. It runs absolutely accurate in parallel with my hardware metronome. It also runs great if i open it with the current Android Chrome app.
It also runs on the android cordova application (Android 4.3.1, Galaxy Nexus) but there are two things that i couldn't figure out yet:
1.) When playing the click sound it sometimes sounds a bit laggy (like it has been triggered twice at a time but not always) and more important:
2.) The tempo seems to be constant but about 10-20 bpm slower compared to my desktop PC with the same settings.
It's kind of hard to put this into a fiddle but i hosted it myself under:
http://gonzales.capella.uberspace.de/sound/
You can find all the sources via the chrome debugger.
Any hint on why this is running slower on Android devices and how i can fix this will help a lot.
"Temp consistently slower" sounds like a sample rate conversion issue. At any rate, looping a generated audio file will work, but is kinda inefficient - I'd suggest a strategy more like the one I detailed in http://www.html5rocks.com/en/tutorials/audio/scheduling/.
BTW - the stock android browser is now Chrome, as of KitKat. That doesn't hit all Android out there, of course, but we are getting there.