【问题标题】:Avoid pops and clicks whilst recording HTML Audio在录制 HTML 音频时避免爆裂声和咔嗒声
【发布时间】:2021-11-03 07:07:30
【问题描述】:

我正在构建一个允许用户使用麦克风录制消息的应用程序,并且正在使用一个名为 mic-recorder-to-mp3 的节点包。构造函数采用bit-rate 设置,当前为128(对于录音来说应该绰绰有余)。

我们已经开始用这个应用程序收集录音,有些很好,但其他的真的很糟糕,咔哒声和砰砰声。

我知道sample-rate 无法设置并且基于您正在使用的硬件,但是我还缺少其他什么吗?这个比特率是不是太高了?我需要为AudioBuffer 设置更多内存吗?非常感谢任何建议。

【问题讨论】:

    标签: html5-audio web-audio-api


    【解决方案1】:

    我很高兴地发现,您现在可以在拨打getUsermedia 时设置限制条件,这可以提高录音质量。它们在网络音频规范中为 MediaTrackConstraints: https://developer.mozilla.org/en-US/docs/Web/API/MediaTrackConstraints

    及用法:

    export const audioTrackConstraints = {
      echoCancellation: {exact: false},
      autoGainControl: {exact: false},
      noiseSuppression: {exact: false},
      sampleRate: 16000,
      }
    navigator.mediaDevices.getUserMedia({ audio: audioTrackConstraints})
    .then(() => {
      console.log('Permission Granted');
    })
    .catch((error) => {
      console.log(error.message);
    })
    

    【讨论】:

      猜你喜欢
      • 2016-11-16
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2011-06-17
      • 2013-01-26
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多