I'm wondering if there are any plug-ins/libraries or awesome tools that would let me script sound/music with javascript in a browser in a similar way to how <canvas>
allows you to script drawing and animations.
views:
34answers:
2Latest browsers support the <audio>
tag, so you could use that depending on your requirements for browser support.
Yes -- it's not yet ready for mainstream use, but they're working on it!
There's a nascent JavaScript audio data API being actively hacked on by the mozilla group, and the W3C standards body has formed an Audio Incubator Group with a view to make the standards.
For more information about this effort, and how people are using the API, you could read these two posts from createdigitalmusic.com , or read the announcement from the people working on the API.
I believe you'll need a development build of firefox to use it at this stage--its still very much developer-ware.
If however you need to reach a wide audience with your browser-based synthesis, without waiting for this to become standard, you'll need to use a browser plugin like flash or Java in the meantime.
If you only need to trigger samples of pre-recorded or pre-generated audio, then you could use the <audio>
tag. But if you want to do your own synthesis, you'll need a lower level API like the one above.