fasterthanlime / jsmad

:saxophone: Javascript MPEG-1 Audio Layer III (mp3) and ID3v2 decoder
http://audiocogs.org/codecs/mp3/
762 stars 41 forks source link

Avoiding AudioData API #26

Closed gliese1337 closed 13 years ago

gliese1337 commented 13 years ago

I just came across an ingenious method for playing JS-synthesized sound samples without requiring the AudioData API:

new Audio( 'data:audio/wav;base64,'+/sound data goes here/ ).play();

(Found at http://www.p01.org/releases/140bytes_music_softSynth/ .)

Making use of that should provide support for browsers other than Chrome and Firefox- Opera, Safari, etc.

I'll prob'ly work on an AudioData polyfill based on that soon as I get some free time.

gliese1337 commented 13 years ago

Oh hey, just found the same trick in the audiolib.js readme. I find it odd, then, that audiolib and thus jsmad doesn't already support that as a polyfill output mode. I guess there would be the right place to do the updating, rather than the jsmad code.