Enabled noteOff with a linear fade to 0
fade out smoothly using gain and ramping to value. I've chosen an arbitrary amount to fade by here, which I guess isn't great.
This commit is contained in:
parent
37684b82c5
commit
15d4d0cb1e
1 changed files with 7 additions and 4 deletions
|
@ -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) {
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue