diff --git a/js/MIDI/Plugin.js b/js/MIDI/Plugin.js index 7647f965..015c205e 100644 --- a/js/MIDI/Plugin.js +++ b/js/MIDI/Plugin.js @@ -246,9 +246,14 @@ if (window.AudioContext || window.webkitAudioContext) (function () { // @Miranet: "the values of 0.2 and 0.3 could ofcourse be used as // a 'release' parameter for ADSR like time settings." // add { "metadata": { release: 0.3 } } to soundfont files - sources[source].gain.linearRampToValueAtTime(1, delay); - sources[source].gain.linearRampToValueAtTime(0, delay + 0.2); - sources[source].noteOff(delay + 0.3); + sources[source].gainNode.gain.linearRampToValueAtTime(1, delay); + sources[source].gainNode.gain.linearRampToValueAtTime(0, delay + 0.2); + if (source.noteOff) { // old api + sources[source].noteOff(delay + 0.3); + } else { // new api + sources[source].stop(delay + 0.3); + } + delete sources[source]; } };