JSFiddle - React, Tailwind, and code Playground

HTML

frequency modulation test<br>
<button id="start">start</button>

CSS

body {
    font-size: 25px;
}

JavaScript

var context;
if (typeof AudioContext !== "undefined") {
    context = new AudioContext();
} else if (typeof webkitAudioContext !== "undefined") {
    /*jshint newcap:false*/
    context = new webkitAudioContext();
} else {
    window.alert("WebAudio isn't supported in this browser yet :-(");
    throw new Error('AudioContext not supported. :(');
}

var mod, modGain, osc;

var out = context.destination;

var startTest = function(){
    mod = context.createOscillator();
    mod.frequency.value = 8;
    
    modGain = context.createGain();
    modGain.gain.value = 30;
    
    osc = context.createOscillator();
    osc.frequency.value = 300;
    
    mod.connect(modGain);
    modGain.connect(osc.frequency);
    osc.connect(out);

    osc.start(0);
    mod.start(0);
};

var stopTest = function(){
    osc.stop(0);
    mod.stop(0);
    mod = modGain = osc = null;
};

// UI

var started = false;
document.getElementById("start").onclick = function(){
    if (started) {
        this.innerHTML = "start";
        started = false;
        stopTest();
    } else {
        this.innerHTML = "stop";
        started = true;
        startTest();
    }
};