Skip to content

Instantly share code, notes, and snippets.

View JorenSix's full-sized avatar

Joren Six JorenSix

View GitHub Profile
@JorenSix
JorenSix / web-audio-fetch-stream.js
Created February 20, 2018 19:55 — forked from revolunet/web-audio-fetch-stream.js
Web Audio streaming with fetch API
//
// loads remote file using fetch() streams and "pipe" it to webaudio API
// remote file must have CORS enabled if on another domain
//
// mostly from http://stackoverflow.com/questions/20475982/choppy-inaudible-playback-with-chunked-audio-through-web-audio-api
//
function appendBuffer( buffer1, buffer2 ) {
var tmp = new Uint8Array( buffer1.byteLength + buffer2.byteLength );
tmp.set( new Uint8Array( buffer1 ), 0 );