JSFiddle - React, Tailwind, and code Playground

HTML

<button onclick="doStuff()">
    סירנה
</button>

JavaScript

function doStuff() {
    
    var SineWave = function(context) {
      var that = this;
      this.x = 0; // Initial sample number
      this.sx = 0; 
      this.context = context;
      this.node = context.createScriptProcessor(1024, 1, 1);
      this.node.onaudioprocess = function(e) { that.process(e) };
    }

    SineWave.prototype.process = function(e) {
      var data = e.outputBuffer.getChannelData(0);
      for (var i = 0; i < data.length; ++i) {
        var a = Math.sin(this.sx+=0.00004);
        data[i] = Math.sin(this.x+=(0.1 + (0.02*a)));
      }
    }

    SineWave.prototype.play = function() {
      this.node.connect(this.context.destination);
    }

    SineWave.prototype.pause = function() {
      this.node.disconnect();
    }

    new SineWave(new AudioContext()).play();
}