Michael Deal 2013-01-25 09:33:47 -08:00
parent 485a2be277
commit c97c636cd1
1 changed files with 9 additions and 5 deletions

View File

@ -4,7 +4,10 @@
--------------------------------------------
https://github.com/mudcube/MIDI.js
--------------------------------------------
APIs:
Inspired by javax.sound.midi (albeit a super simple version):
http://docs.oracle.com/javase/6/docs/api/javax/sound/midi/package-summary.html
--------------------------------------------
Technologies:
MIDI.WebMIDIAPI
MIDI.WebAudioAPI
MIDI.Flash
@ -175,15 +178,16 @@ if (window.AudioContext || window.webkitAudioContext) (function () {
return source;
};
// 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) {
delay = delay || 0;
if (delay < ctx.currentTime) delay += ctx.currentTime;
var source = sources[channel + "" + note];
if (!source) return;
// @Miranet: "the values of 0.4 and 0.5 could ofcourse be used as
// a 'release' parameter for ADSR like time settings."
source.gain.linearRampToValueAtTime(1, delay);
source.gain.linearRampToValueAtTime(0, delay + 0.75);
source.noteOff(delay + 0.75);
source.gain.linearRampToValueAtTime(0, delay + 0.4);
source.noteOff(delay + 0.5);
return source;
};