tweaks to tracking scheduling, and amplitude
This commit is contained in:
parent
7bbcb64819
commit
379fd543ff
|
@ -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:
|
||||||
|
|
|
@ -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;
|
||||||
|
|
Loading…
Reference in a new issue