Hi! Really love this project. While looking through the audio engine, I noticed a potential memory leak that could degrade audio performance over long sessions.
In SynthEngine.js (or main.js), when old oscillators are stopped in playNotes(), the disconnect() method is never called:
javascript
this.oscillators.forEach((osc) => { try { osc.stop(); } catch {} });
Because they aren't disconnected from the waveShaper, the stopped nodes remain attached to the audio graph and are not properly garbage collected by the browser.
Suggested Fix: Add osc.disconnect() immediately after stopping the oscillator.
javascript
this.oscillators.forEach((osc) => {
try {
osc.stop();
osc.disconnect();
} catch {}
});
Hi! Really love this project. While looking through the audio engine, I noticed a potential memory leak that could degrade audio performance over long sessions.
In SynthEngine.js (or main.js), when old oscillators are stopped in playNotes(), the disconnect() method is never called:
javascript
this.oscillators.forEach((osc) => { try { osc.stop(); } catch {} });
Because they aren't disconnected from the waveShaper, the stopped nodes remain attached to the audio graph and are not properly garbage collected by the browser.
Suggested Fix: Add osc.disconnect() immediately after stopping the oscillator.
javascript
this.oscillators.forEach((osc) => {
try {
osc.stop();
osc.disconnect();
} catch {}
});