0

我正在使用 web 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 控制器播放时这对我没有帮助,因为我不知道什么时候会发布。

4

1 回答 1

0

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

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

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

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

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

于 2019-06-29T11:41:46.447 回答