From 4e8b1b2584a68afff5a0f3360618dd98dfa051de Mon Sep 17 00:00:00 2001 From: you Date: Sun, 22 Mar 2026 18:31:36 +0000 Subject: [PATCH] =?UTF-8?q?Audio:=20fix=20pop/crackle=20=E2=80=94=20expone?= =?UTF-8?q?ntial=20ramps=20+=20longer=20release=20tail?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Linear gain ramps + osc.stop() too close to release end caused waveform discontinuities. Switched to exponentialRamp (natural decay curve), 0.0001 floor (-80dB), 50ms extra headroom before oscillator stop. --- public/audio-v1-constellation.js | 8 ++++---- public/index.html | 2 +- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/public/audio-v1-constellation.js b/public/audio-v1-constellation.js index 1f0f8b24..64c9ca3d 100644 --- a/public/audio-v1-constellation.js +++ b/public/audio-v1-constellation.js @@ -98,14 +98,14 @@ envGain.gain.setValueAtTime(0, noteStart); envGain.gain.linearRampToValueAtTime(voiceVol, noteStart + a); - envGain.gain.linearRampToValueAtTime(voiceVol * s, noteStart + a + d); - envGain.gain.setValueAtTime(voiceVol * s, noteEnd); - envGain.gain.linearRampToValueAtTime(0.001, noteEnd + r); + envGain.gain.exponentialRampToValueAtTime(Math.max(voiceVol * s, 0.0001), noteStart + a + d); + envGain.gain.setValueAtTime(Math.max(voiceVol * s, 0.0001), noteEnd); + envGain.gain.exponentialRampToValueAtTime(0.0001, noteEnd + r); osc.connect(envGain); envGain.connect(filter); osc.start(noteStart); - osc.stop(noteEnd + r + 0.01); + osc.stop(noteEnd + r + 0.05); osc.onended = () => { osc.disconnect(); envGain.disconnect(); }; } diff --git a/public/index.html b/public/index.html index 9a322cad..55cb6ca1 100644 --- a/public/index.html +++ b/public/index.html @@ -91,7 +91,7 @@ - +