I am writing an app in Electron and React in which I need to record small pieces of user speech. The user is presented with words to repeat and I make a recording of each word, one by one, starting the recording about 500ms before the word appears to the screen for the user to read out loud, meaning that all recordings start with a brief silence. For recording, I use the Web Audio API (MediaRecorder and GetUserMedia).
My problem is that some recordings are truncated when the user starts to speak, the beginning of some words not being recorded, although the preceding silence is in the recording. I am not sure where this comes from but it seems that upgrading the Electron version alleviates the problem but I still find that weird because:
- I tried running a simple recording code in a HTML/CSS/JS only page in Electron 1.6.2 and it is perfect
- As soon as I use my complete app code with React, in the same Electron version, the problem appears
- But running the same app code (with React) outside of Electron, it is perfect again.
- So then I tried my complete app code with React in Electron 1.8.7 and it’s somewhat better, and in 2.0.2 it’s acceptable.
The fact that it works correctly in Electron 1.6.2 with the simple HTML page makes me doubt it’s only an Electron version issue, but I have no idea how to explain that.
Does anyone have an idea about why and how to prevent that truncating at the beginning of the recordings?