【问题标题】:Why doesn't triggerRelease have a note parameter in Tone.js?为什么在 Tone.js 中 triggerRelease 没有 note 参数?
【发布时间】:2019-06-29 19:41:46
【问题描述】:

我正在使用网络 MIDI 从我的 MIDI 控制器播放音符。我想听听他们的声音,所以我正在使用 Tone.js。

我看到它有两种实时播放方法: https://github.com/Tonejs/Tone.js/wiki/Instruments

//trigger the start of a note at `time` with a velocity of 50%
synth.triggerAttack("C4", time, 0.5);

//trigger the release at `time`
synth.triggerRelease(time);

但是他们不是忘记了triggerRelease中的note参数吗?它怎么知道要发布什么笔记?

我还看到了 triggerAttackAndRelease ,但是当我从 MIDI 控制器播放时这对我没有帮助,因为我不知道何时会发生释放。

【问题讨论】:

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


    【解决方案1】:

    triggerRelease 方法确实将注释作为参数:

    soundtrack.synth.triggerRelease(note.renderAbc());
    

    在给定时间释放它也可能需要一些时间:

    soundtrack.synth.triggerRelease(note.renderAbc(), releaseTime);
    

    释放时间是运输上的绝对时间。

    【讨论】:

      猜你喜欢
      • 2019-05-24
      • 2013-01-29
      • 2022-10-17
      • 1970-01-01
      • 2021-12-13
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多