in src/js/client/microphone.ts [137:160]
getMicStream(){
const me = this;
const bufferLength = 4096;
me.source = me.audioContext.createMediaStreamSource(me.mediaStream);
me.scriptProcessor =
me.audioContext.createScriptProcessor(bufferLength,1,1);
this.scriptProcessor.onaudioprocess = (e)=> {
console.log(e.inputBuffer.getChannelData(0));
let stream = e.inputBuffer.getChannelData(0) ||
new Float32Array(bufferLength);
// TODO this is the problem, the 2nd time,
// after starting the recording processor
// the buffer is empty.
// this happens after this connecting
let event = new CustomEvent('audio', {
detail: this.convertFloat32ToInt16(stream)
});
window.dispatchEvent(event);
};
}