<script>
function myFunctionOff() { document.getElementById("demo").innerHTML var AudioContext = "OFF"; gainObjwindow.gainAudioContext || window.value = 0;}function myFunctionOn(f) { document.getElementById("demo").innerHTML = "ON"; osc.frequency.value = f; setTimeout(10); gainObj.gain.value = 1; }function myFunctionRange(f) { document.getElementById("demo").innerHTML = f; osc.frequency.value = f; setTimeout(10); gainObj.gain.value = 1webkitAudioContext; }
context = new AudioContext;
osc = context.createOscillator();
osc.type=osc.SQUARE;
osc.frequency.value = 440;
// osc.start(0);
var gainObj = context.createGain();
gainObj.gain.value = 01;
osc.connect(gainObj);
gainObj.connect(context.destination);
function myFunctionOff() {
document.getElementById("demo").innerHTML = "OFF";
osc.stop(0);
}
function myFunctionOn(f) {
document.getElementById("demo").innerHTML = "ON";
osc = context.createOscillator();
osc.type=osc.SQUARE;
osc.connect(gainObj);
osc.frequency.value = f;
osc.start(0);
}
function myFunctionRange(f) {
document.getElementById("demo").innerHTML = f;
osc = context.createOscillator();
osc.type=osc.SQUARE;
osc.connect(gainObj);
osc.frequency.value = f;
osc.start(0);
}
</script>