I need a single-shot square wave of approximately 20 ms width. I have not found a simple autonomous code sample to do this.
Without external libraries and with only a couple of lines of code can this be done? It was easy to do on an IBM XT running DOS. I did an extended search with creative keywords but found nothing.
I saw a hint that one can construct a sound locally (replacing ...data... with actual data):
var playSound = (function beep () {
var snd = new Audio ("data:audio/wav;base64,//...data...");
return function () {
snd.play();
}
}) ();
and then running:
playSound ();
But these examples didn't work. I have chrome, firefox, opera, and a couple of other browsers.
Does anyone know how to do this without much code?