【问题标题】:Web Audio - Change pitch of live microphone网络音频 - 更改现场麦克风的音高
【发布时间】:2015-12-17 09:02:54
【问题描述】:

我有这段代码可以在我的麦克风和扬声器之间建立实时连接。是否可以实时改变我的声音音调?

navigator.getUserMedia(
  { audio: true },
  function(stream) {
    window.AudioContext = window.AudioContext || window.webkitAudioContext;
     var ctx= new AudioContext();

     // Create an AudioNode from the stream.
     var mediaStreamSource = ctx.createMediaStreamSource( stream );

     // Connect it to the destination to hear yourself (or any other node for processing!)
     mediaStreamSource.connect( ctx.destination );

  },
  function(err) {
    console.log(err);
  }
);

【问题讨论】:

    标签: javascript html web-audio-api


    【解决方案1】:

    其实这是可以的。我在 Input Effects 演示(https://webaudiodemos.appspot.com/input/index.html,选择“Pitch Shifter”)中使用了粒度再合成方法,使用了一对具有循环斜坡延迟时间的延迟节点。如果你想做一些更高级的事情(比如相移语音编码),你可能需要一个 ScriptProcessor/AudioWorker。

    【讨论】:

    • 完全是 Chris Rogers 的代码——尽管我确实想出了一个聪明的方法来动态控制音高延迟。 :)
    【解决方案2】:

    除非您在 ScriptProcessorNode 或即将推出的 AudioWorkerNode 中自己实现它,否则我认为 WebAudio 没有任何方法可以进行音调转换。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2017-10-26
      • 1970-01-01
      • 2016-08-08
      • 1970-01-01
      • 2018-06-18
      • 1970-01-01
      相关资源
      最近更新 更多