[lively-kernel] Lively Audio

Chris Double chris.double at double.co.nz
Wed Apr 21 04:07:51 CEST 2010

On 21/04/10 12:34, Dan Ingalls wrote:
>>> You can use HTML 5 audio via data URL's to generate sound and play it -
>>> although it's a bit of a pain doing it this way.
> Do you mean one data URL per note (88 of them), with no control over, eg,
> duration, pitch, etc?  Or is there something better?

The approach I was thinking of was something like this:


You generate the audio data, attach a WAV header and play it with an 
audio element. It's a bit hacky but does work.

Ideally there would be an actual audio API allowing generating and 
playing samples - this is something a lot of people are interested in 
and they're exploring possibly API's for standardisation.

> Can you say a bit more?  Can one serve up (or otherwise obtain) one .WAV file
> and then use that as a timbre by ASDR techniques so you can play all 88
> notes in various durations and volumes from that one file?

Technically you could load the .WAV file using XMLHttpRequest, get the 
raw data, manipulate it and create data URL's containing the modified 
data. Although not using WAV I have an example of loading a file 
containing binary data and parsing it (using an Ogg file for the 
example) here:


Another approach if you don't mind using flash is to use one of the 
Flash based audio libraries:



More information about the lively-kernel mailing list