From 4b075e8979066c47f59687aec8644b0b9aed1191 Mon Sep 17 00:00:00 2001 From: Xiaohan-Tian <157918347+Xiaohan-Tian@users.noreply.github.com> Date: Fri, 19 Dec 2025 12:55:56 -0800 Subject: [PATCH] fix: reduce Tone.js context.lookAhead to reduce MIDI input latency --- src/core/audio-interface/KGAudioInterface.ts | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/core/audio-interface/KGAudioInterface.ts b/src/core/audio-interface/KGAudioInterface.ts index a480145..33f2377 100644 --- a/src/core/audio-interface/KGAudioInterface.ts +++ b/src/core/audio-interface/KGAudioInterface.ts @@ -64,6 +64,9 @@ export class KGAudioInterface { } try { + // Reduce lookahead time to 0.05 seconds to improve MIDI input responsiveness + Tone.getContext().lookAhead = 0.05; + // Set up master gain for volume control this.masterGain = new Tone.Gain(this.masterVolume).toDestination();