soundfont-player icon indicating copy to clipboard operation
soundfont-player copied to clipboard

How to play a note and specify its velocity?

Open a1exwang opened this issue 5 years ago • 2 comments

a1exwang avatar Jul 19 '20 08:07 a1exwang

I agree that this would be a nice feature, especially since I did not find any way to implement this with oscillators or other libraries.

fheyen avatar Jul 09 '21 16:07 fheyen

Passing velocity to the gain option seems to work e.g.

  let envelope = tone.play(
    note,
    when,
    {
      gain: velocity,
      sustain: 3.5,
    })

abulka avatar May 10 '22 08:05 abulka