Skip to content

Instantly share code, notes, and snippets.

@gliese1337
Created October 19, 2011 19:15
Show Gist options
  • Save gliese1337/1299361 to your computer and use it in GitHub Desktop.
Save gliese1337/1299361 to your computer and use it in GitHub Desktop.
AudioData polyfill based on AudioLib
Audio = (function(){
return {
sampleRate:44100,
channelCount:1,
WriteAudio:function(soundData){
new Audio( 'data:audio/wav;base64,'+btoa(
audioLib.PCMData.encode({
data: soundData,
sampleRate: this.sampleRate,
channelCount: this.channelCount,
bytesPerSample: 4 //32-bit floats
})
)).play();
}
}
}());
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment