Today's snippet: generating a simple musical tone purely from JavaScript. I saw some online samples for doing it on a server (e. g. in PHP) and sending to the client, but that's a waste of bandwidth.
The ingredients are twofold:
- An <audio> element with a source that's populated from a data: URI
- An ArrayBuffer object with WAV data inside