oscillator start/stop

JavaScript

c = new AudioContext;
o = c.createOscillator();
o.connect(c.destination);
o.onended = function () {
    alert("done");
};
o.start();
o.stop();
o.stop(c.currentTime + 0.5);
setTimeout(function () {
    alert("elpased: " + c.currentTime);
}, 1000);