On my desktop, this prints every 850-950 ms.
require(['$api/audio', '$api/models'], function (audio, models) {
var analyzer = audio.RealtimeAnalyzer.forPlayer(models.player);
var last_position = -1;
analyzer.addEventListener('audio', function (evt) {
models.player.load('position').done(function() {
if(models.player.position != last_position) {
console.log(models.player.position + ", " + (models.player.position-last_position));
last_position = models.player.position;
}
});
});
});
Not the best solution, for sure.
OTOH, the realtime analyzer is supposed to be reporting info pretty reliably with the music, I'd suspect you could just count calls and assume you're very close to multiples of 256 ms.