【问题标题】:Tone JS - filter not applying to samplerTone JS - 过滤器不适用于采样器
【发布时间】:2021-01-20 19:01:22
【问题描述】:

我正在使用 Tone JS 来制作声音,我想在我的 Sampler 乐器中添加一个过滤器,我从文档中的理解是我可以通过在采样器上使用 connect 方法并传入过滤器来做到这一点作为论据:

const filter = new Filter(20000, "highpass").toDestination();
this.sampler = new Sampler({
  urls: { C1: 'C1.wav' },
  baseUrl: "/static/samples/piano/",
})
  .connect(filter)
  .toDestination();

上面没有应用声音播放时的过滤效果,我不知道为什么?

【问题讨论】:

    标签: javascript web-audio-api tone.js


    【解决方案1】:

    使用链命令将采样器连接到过滤器,然后连接到目标。然后使用 onload 回调启动声音。

    试试这个:

    const filter = new Tone.Filter(20000, "highpass");
    const sampler = new Tone.Sampler({
      urls: { C1: 'C1.wav' },
      baseUrl: "/static/samples/piano/",
      onload: () => {
        sampler.chain(filter, Tone.Destination);
        sampler.triggerAttackRelease(["D4"], 3);
    });

    【讨论】:

      猜你喜欢
      • 2021-01-08
      • 2022-01-11
      • 2017-09-12
      • 2019-06-17
      • 2014-03-11
      • 2021-07-07
      • 2017-10-06
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多