I am trying to record audio using Recorder.JS. I have encountered an intermittent issue where the audio buffer is occasionally an array of all zeros: [0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0]. I traced these zeros back, and the blank audio array is being returned directly from inputBuffer.getChannelData(0) where inputBuffer comes directly from the Audio Context. Below is a simplification of what is happening:
const _audioContext = new AudioContext();
const processor = _audioContext.createScriptProcessor(...);
processor.onaudioprocess = (evt) => {
console.log(evt.inputBuffer.getChannelData(0)); //<----- the array output here is an array of all zeros
}