Merge pull request #7 from pete-otaqui/patch-2

Enabled noteOff with a linear fade to 0
This commit is contained in:
Michael Deal 2012-11-20 22:57:12 -08:00
commit 766ce13982

View file

@ -102,11 +102,14 @@ if (window.AudioContext || window.webkitAudioContext) (function () {
}; };
// FIX: needs some way to fade out smoothly.. // FIX: needs some way to fade out smoothly..
// POSSIBLE FIX: fade out smoothly using gain and ramping to value
root.noteOff = function (channel, note, delay) { root.noteOff = function (channel, note, delay) {
// var source = sources[channel+""+note]; var source = sources[channel+""+note];
// if (!source) return; if (!source) return;
// source.noteOff(delay || 0); source.gain.linearRampToValueAtTime(1, delay);
// return source; source.gain.linearRampToValueAtTime(0, delay + 0.1);
source.noteOff(delay || 0);
return source;
}; };
root.chordOff = function (channel, chord, delay) { root.chordOff = function (channel, chord, delay) {