From 4def86168b84ddb0f9f52cd110ff67fe2d869f6a Mon Sep 17 00:00:00 2001 From: 3dtours Date: Mon, 27 Jul 2026 12:02:50 +0700 Subject: [PATCH] fix: send CC64=0 + CC121=0 before noteOff (reset sustain + all controllers) --- app/static/js/services/soundfontPlayer.js | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/app/static/js/services/soundfontPlayer.js b/app/static/js/services/soundfontPlayer.js index 6494982..3b16690 100644 --- a/app/static/js/services/soundfontPlayer.js +++ b/app/static/js/services/soundfontPlayer.js @@ -173,10 +173,14 @@ stopNote: function (channel, pitch) { if (channel < 0 || channel > 15) return; if (_initialized && _synthInstance) { + // Ensure sustain is OFF before noteOff (SpessaSynth uses >=8192 threshold) + try { _synthInstance.controllerChange(channel, 64, 0); } catch (e) {} + // Standard noteOff with multiple velocity variants try { _synthInstance.noteOff(channel, pitch); } catch (e) {} try { _synthInstance.noteOff(channel, pitch, 0); } catch (e) {} - try { _synthInstance.allNotesOff(channel); } catch (e) {} + // Backup: All Notes Off + reset controllers try { _synthInstance.controllerChange(channel, 123, 0); } catch (e) {} + try { _synthInstance.controllerChange(channel, 121, 0); } catch (e) {} } },