Skip to content Skip to sidebar Skip to footer

Web Audio API - Live Stream 'clicks' Between Chunks.

I am trying to stream audio through a websocket on a node.js (express) server to a web browser. The audio is coming from an iOS device as 16-bit, mono wav files sampled at 4k (4000

Solution 1:

1) The audio I was receiving was actually at 2k by mistake, but the wav header still said 4k, thus the double speed error.

2) See the last paragraph of Chris Wilsons answer here:

Finally - this is not going to work well if the sound stream does not match the default audio device's sample rate; there are always going to be clicks, because decodeAudioData will resample to the device rate, which will not have a perfect duration. It will work, but there will likely be artifacts like clicks at the boundaries of chunks. You need a feature that's not yet spec'ed or implemented - selectable AudioContext sample rates - in order to fix this.

Brion Vibbers AudioFeeder.js works great without any clicks but requires raw 32bit pcm data. Also be wary of upsampling artifacts!


Solution 2:

Another option : You can use the MediaSource API to overcome those glitches between the audio.

If you need full fledged research on this, use this : MSE for Audio


Post a Comment for "Web Audio API - Live Stream 'clicks' Between Chunks."