I am currently developing a walkie-talkie type environment. Recording and resampling audio work fine now (thanks for the help), playing works .. sort of.
My data comes in (WAV-) blobs, so here's what I do:
audioPlay(blob)
{
var fileReader = new FileReader();
fileReader.onload = function() {
theContext.decodeAudioData(this.result, function(buffer) {
var source = theContext.createBufferSource();
source.buffer = buffer;
source.connect(theContext.destination);
source.start(0);
});
};
fileReader.readAsArrayBuffer(blob);
}
But every new audio adds a slight start-delay which grows with every new audio. After a few audios, the delay adds almost 2-3 seconds. Logging doesn't show any delays, program flows fine all the way down to .source.start.
Any ideas?