Dynamic .WAV Generation in JavaScript
http://sk89q.therisenrealm.com/2008/11/dynamically-generating-a-wav-in-javascript/
This plays a sine wave by generating a .wav file on-the-fly and playing it
through an EMBED tag linked by a data URI. No
external files are used to play the sine wave.
Be aware of the following caveats:
- This has been tested to work on Firefox, Opera, Safari, and Chrome.
- You need to have a plugin to play the .wav files, and it should support "auto-play."
- The generated .wav files cannot become too large or otherwise browsers will not
process them. The default settings are known to work.
- The tracks on a normal CD
(Red Book standard),
for comparison, are sampled at 44,100 Hz and has 16 bits per sample.
Result
Size of .wav file:
Length of data URI:
Player plugin