tweaks to tracking scheduling, and amplitude

This commit is contained in:
Michael Deal 2013-01-21 10:10:44 -08:00
parent 7bbcb64819
commit 379fd543ff
2 changed files with 3 additions and 4 deletions

View file

@ -235,7 +235,7 @@ var startAudio = function (currentTime, fromCache) {
eventQueue.push({ eventQueue.push({
event: event, event: event,
source: MIDI.noteOff(channel, event.noteNumber, currentTime / 1000 + ctx.currentTime), source: MIDI.noteOff(channel, event.noteNumber, currentTime / 1000 + ctx.currentTime),
interval: scheduleTracking(channel, note, queuedTime, offset - 10, 128) interval: scheduleTracking(channel, note, queuedTime, offset, 128)
}); });
break; break;
default: default:

View file

@ -89,10 +89,9 @@ if (window.AudioContext || window.webkitAudioContext) (function () {
source.connect(ctx.destination); source.connect(ctx.destination);
/// ///
var gainNode = ctx.createGainNode(); var gainNode = ctx.createGainNode();
var value = -0.5 + (velocity / 100) * 2; var value = (velocity / 100) * masterVolume * 2 - 1;
var minus = (1 - masterVolume) * 2;
gainNode.connect(ctx.destination); gainNode.connect(ctx.destination);
gainNode.gain.value = Math.max(-1, value - minus); gainNode.gain.value = Math.max(-1, value);
source.connect(gainNode); source.connect(gainNode);
source.noteOn(delay || 0); source.noteOn(delay || 0);
return source; return source;