diff --git a/app/static/js/services/soundfontPlayer.js b/app/static/js/services/soundfontPlayer.js index 60dd5e2..a6c451e 100644 --- a/app/static/js/services/soundfontPlayer.js +++ b/app/static/js/services/soundfontPlayer.js @@ -172,8 +172,12 @@ playNote: function (note, velocity, durationMs, startTime, program, destinationNode, channel, synthEngine) { if (_initialized && _synthInstance && _currentSfId) { return this._playNoteSpessa(note, velocity, durationMs, startTime, program, channel, synthEngine); + } else { + if (_initialized && _synthInstance && !_currentSfId) { + console.warn("[SonicSF] No sound bank loaded, using oscillator fallback"); + } + return this._playNoteOsc(note, velocity, durationMs, startTime, program, destinationNode, channel, synthEngine); } - return this._playNoteOsc(note, velocity, durationMs, startTime, program, destinationNode, channel, synthEngine); }, _playNoteSpessa: function (note, velocity, durationMs, startTime, program, channel, synthEngine) { @@ -198,7 +202,10 @@ try { _synthInstance.noteOn(channel, midiPitch, midiVel); setTimeout(() => { try { _synthInstance.noteOff(channel, midiPitch); } catch (e) {} }, durSec * 1000); - } catch (e) {} + } catch (e) { + console.warn("[SonicSF] SpessaSynth noteOn failed, falling back to oscillator:", e); + this._playNoteOsc(note, velocity, durationMs, startTime, program, null, channel, synthEngine); + } }; if (scheduledTime > 0) setTimeout(doNoteOn, scheduledTime * 1000); else doNoteOn(); },