Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

使用sourceStream设置双声道的流时仍然导出的是单声道音频 #256

Open
hejie615 opened this issue Dec 5, 2024 · 1 comment

Comments

@hejie615
Copy link

hejie615 commented Dec 5, 2024

已经设置了sourceStream为什么导出的时候倒是单声道音频还需要额外处理什么吗
let recorderNew: any = null;
export const recordStartNew = () => {
navigator.mediaDevices
.getUserMedia({
audio: {
channelCount: 2,
},
})
.then((stream) => {
const audioContext = new window.AudioContext();
const source = audioContext.createMediaStreamSource(stream);
// 创建双声道处理
const channelMerger = audioContext.createChannelMerger(2);
source.connect(channelMerger);
channelMerger.connect(audioContext.destination);
recorderNew = RecorderNew({
type: "wav", // 录音格式,可以换成wav等其他格式
sampleRate: 48000, // 录音的采样率,越大细节越丰富越细腻
bitRate: 16, // 录音的比特率,越大音质越好
sourceStream: stream,
});
recorderNew.open(() => {
recorderNew.start();
});
// 成功回调,返回媒体流
})
.catch((error) => {
// 错误处理
});
};

@xiangyuecn
Copy link
Owner

Recorder只支持单声道,没有支持双声道,双声道的stream也只会录到单个声道

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants