danigb / soundfont-player

Quick soundfont loader and player for browser
MIT License
453 stars 60 forks source link

instrument.play() works, how do I turn a note off? #59

Open fornof opened 6 years ago

fornof commented 6 years ago

How do I turn a note off or set the duration of the note? for notes on: piano.play(event.noteName, ac.currentTime, {gain:event.velocity/5}); I have a midi off event, I would like to turn the note off I tried piano.stop(event.noteName, ac.currentTime, {}); but this obviously doesn't work. Any suggestions would be appreciated. Thanks for your help.

danigb commented 6 years ago

This library uses sample-player:

const note = piano.play(...);
note.stop();

Hope it helps