Search code examples
message-queueaudio-streamingweb-audio-api

Does Web Audio API support a queue of multiple input buffers?


I am rendering audio in the browser (mobile/desktop) which arrives over the network (via web sockets) as a potentially endless stream of successive audio buffers (Float32Array typed arrays) and to minimize chance of playback starvation I'd like to queue up multiple buffers prior to start of audio rendering. Does Web Audio API support the notion of queuing up multiple buffers (like OpenAL) to be rendered sequentially in a streaming fashion ? I am not speaking of simultaneous rendering of multiple buffers. Before I roll my own ...


Solution

  • This is something you need to handle yourself. As far as I know, there is no way to queue up multiple buffers for the API to play back on its own.

    You can use a ScriptProcessorNode to implement yourself.