JSFiddle - React, Tailwind, and code Playground
JavaScript
var ctx = new webkitAudioContext();
var node = ctx.createJavaScriptNode(2048);
var then, now;
node.onaudioprocess = function(evt) {
now = ctx.currentTime;
document.write(now - then + '<br>');
then = now;
};
// Wait for ... something to be ready (otherwise first callback is uniformly late)
setTimeout(function() {
then = ctx.currentTime;
node.connect(ctx.destination);
}, 100);
setTimeout(function() {
node.disconnect();
}, 10000);