Stream large audio files for the web audio API

Does anyone have any examples or suggestions on how to put streaming large audio files for the Web Audio API? Reading the W3C spec, they recommend streaming when files are large compared to XMLHTTPRequest (note: there is currently an error preventing the opening of large Chromium Issue 71704 files )

Examples provided by Google show using XMLHTTPRequest for uploading small (<1MB Wave files)

Any help would be appreciated.

thanks

+7
source share
2 answers

The <audio> element is a transition method because it handles streams and buffering under the hood. Starting with Chrome 18, you can use <audio> elements as input sources for further processing using createMediaElementSource() . Read more here:

http://updates.html5rocks.com/2012/02/HTML5-audio-and-the-Web-Audio-API-are-BFFs

+8
source

This does not give a direct answer to your question, but it will be useful.

An asynchronous decodeAudioData method has decodeAudioData added to the API. It will still use XHR, but it is worth switching your code to it. The new method is available in Chrome 14.

 // Use async decoder if it is available. if (context.decodeAudioData) { context.decodeAudioData(arrayBuffer, function(buffer) { source.buffer = buffer; }, function(e) { console.log(e); }); } else { source.buffer = context.createBuffer(arrayBuffer, false); } 
+5
source

All Articles