JavaScript Song Player

http://sk89q.therisenrealm.com/2008/11/dynamically-generating-a-wav-in-javascript/

This plays a song by generating (many) .wav files on-the-fly and playing them all through an EMBED tag linked by a data URI. No external files are used to play the song. You can save the source of this page and it will work anywhere you try it. Due to the length limit of data: URIs, multiple .wav files are used.

Parameters
Hz
bits/sample

The format is as follows: OCTAVE NOTE LENGTH
OCTAVE is an integer between 0 and 9, inclusive
NOTE is one of C, C#, D, D#, E, F, F#, G, G#, A, A#, B
LENGTH is whole, half, quar, eight, or sixth
For dotted notes, put a dot immediately after the length word; ex. quar.
To combine note lengths, use a plus; ex. quar.+half
Comments begin with a hash mark (#)
To set tempo, use @tempo TEMPO

Written by sk89q.