Generating a tone using pure javascript with Chromium WebAudio API
The Web Audio API has what's known as the Oscillator Interface to generate the tones you're talking about. They're pretty straight forward to get going...
var context = new webkitAudioContext(), //Call function on context oscillator = context.createOscillator(); // Oscillator defaults to sine waveoscillator.connect(context.destination);oscillator.start();
You can change the type of wave by doing:
oscillator.type = 1; // Change to square wave.
or alternatively:
oscillator.type = oscillator.SQUARE;
I've written an article about this very topic in more detail, so that might be of some use to you!
Probably not these best way, but I used dsp.js to generate different types of sinusoids, then passed them off to the Web Audio API in this demo: http://www.htmlfivewow.com/demos/waveform-generator/index.html