简体   繁体   English

如何使用 webrtc 录制高质量的立体声音频?

[英]How to use webrtc to record high quality stereo audio?

Is there a way to set line-in quality using javascript?有没有办法使用 javascript 设置线路输入质量?

Instead of a microphone, I used an external mp3 player connected to the line in. The recorded audio sounds compressed and is mono.我没有使用麦克风,而是使用连接到线路输入的外部 mp3 播放器。录制的音频听起来是压缩的并且是单声道的。

This effect is tested with the most populair libraries/sample pages (on different computers in both firefox and chrome), it looks like audioin is first compressed and merged into a single track, and then uncompressed and split in multiple channels for the createScriptProcessor callback.这个效果是用最流行的库/示例页面测试的(在不同的计算机上,firefox 和 chrome),看起来音频输入首先被压缩并合并成一个单一的轨道,然后解压缩并在多个通道中拆分以用于 createScriptProcessor 回调。

The newer and still experimental MediaRecorder api (such as used for webrtc.github.io examples) has the same quality problems.较新且仍处于实验阶段的 MediaRecorder api(例如用于 webrtc.github.io 示例)具有相同的质量问题。

Sounds like to need to change your getUserMedia() constraints.听起来需要更改您的 getUserMedia() 约束。 It defaults to settings for voice with echo and noise cancellation processing, but you can override them using these settings:它默认为带有回声和噪声消除处理的语音设置,但您可以使用以下设置覆盖它们:

navigator.mediaDevices.getUserMedia({
  audio: {
    autoGainControl: false,
    channelCount: 2,
    echoCancellation: false,
    latency: 0,
    noiseSuppression: false,
    sampleRate: 48000,
    sampleSize: 16,
    volume: 1.0
  }
});

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM