electron / electron/remote

Issue: Electron14.1.0 can't record truly stereo audio

Open
#216 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
TypeScript
Stars
411
Forks
53
Avg merge
3m
Merged PRs (30d)
1

Description

I'm using the Web Audio API ScriptProcessorNode and AudioWorkletNode to record the stereo audio. But the final audio recording is not truly stereo since the left and right channel data is the same.
This issue occurred on upgrading Electron version from v6 to v14 and add the dependency '@electron/remote'. The same code for recording audio, but previously it output the correct stereo audio.
Can anyone help to give some suggestions or point out what go wrong? Appreciate in advance.

Below are some examples for getting microphone setting:
//The job of audio recording running in the renderer process
let win = new BrowserWindow({
show: false,
parent: remote.getCurrentWindow(),
modal: true,
webPreferences: { plugins: true, webSecurity: false, nodeIntegration: true, contextIsolation: false },
width: 800,
height: 600,
});

// microphone setting
let config = {
audio: {
deviceId: {exact: deviceId},
channelCount: {exact: 2},
}
navigator.mediaDevices.getUserMedia(config).then((stream) => {
try {
let audioTrackSettings = stream.getAudioTracks()[0].getSettings();
log.info(`AudioStream audioTrack->settings: `, audioTrackSettings.channelCount); // It shows the channelCount is 2
let mediaNode = this.context.createMediaStreamSource(stream);
let node = this.context.createScriptProcessor.call(this.context, 4096, 2, 2);

}catch(err){}
).catch(e => {});

Platform
OS: Windows 11
electron: v14.1.0
Nodejs: v16.20
@electron/remote: v2.0.0
vue: v2

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.