eshaz/wasm-audio-decoders

How to playback decoded audio

jjackevans opened this issue · 5 comments

Hi,

I'm having some difficulties with the opus decoder, would you be able to answer a few questions over email?

You can contact me at je1g18@soton.ac.uk if this is ok?

Thanks

eshaz commented

Hi, we can discuss here in this issue if you don't mind. I like to keep these discussions public so that if someone else also has a similar issue they will be able to refer back here.

Hi, we can discuss here in this issue if you don't mind. I like to keep these discussions public so that if someone else also has a similar issue they will be able to refer back here.

How would you recommend playing the audio data (with minimal latency) in the browser, from the decodeFrame callback?

eshaz commented

You can use the Web Audio API to play back the decoded results. You can asynchronously decode using OpusDecoderWebWorker.decodeFrame, put the results into an AudioBuffer, and playback the buffer using an AudioBufferSourceNode.

Here are a few examples of where I use this library to decode audio and playback through the Web Audio api:

Just ran into this issue, I solved it using this code. I hope this helps someone

samirkumardas/pcm-player#11 (comment)

eshaz commented

Thanks all for the input, closing since there are a number of examples noted here.