From 1972add3099688ea2d26857e788b76c042bfa34e Mon Sep 17 00:00:00 2001 From: Armin Date: Mon, 6 Jul 2026 18:10:05 +0200 Subject: [PATCH] Add cutoff max falloff decay selector MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Introduce a new dropdown to control how fast the max-cutoff marker decays toward the live cutoff on the realtime spectrum. Options: Off — max cutoff holds indefinitely (manual reset only) Slow — 1% gap reduction per frame Medium — 3% gap reduction per frame Fast — 8% gap reduction per frame Previously the max-cutoff line only went up and never came back down unless the user clicked Reset. --- index.html | 6 ++++++ js/app.js | 7 +++++++ 2 files changed, 13 insertions(+) diff --git a/index.html b/index.html index 17f4aea..2929eed 100644 --- a/index.html +++ b/index.html @@ -38,6 +38,12 @@ +
diff --git a/js/app.js b/js/app.js index 2960e9f..1ee761b 100644 --- a/js/app.js +++ b/js/app.js @@ -668,6 +668,13 @@ const App = { const nyquist = sr / 2; const cutoffHz = (cutoffBin / len) * nyquist; if (cutoffHz > this.cutoffMaxHz) this.cutoffMaxHz = cutoffHz; + const falloffSel = document.getElementById('cutoffFalloff'); + if (falloffSel && falloffSel.value !== 'off' && this.isPlaying && cutoffHz < this.cutoffMaxHz) { + const falloffMap = { slow: 0.01, medium: 0.03, fast: 0.08 }; + const rate = falloffMap[falloffSel.value] ?? 0; + const gap = this.cutoffMaxHz - cutoffHz; + if (gap > 1) this.cutoffMaxHz -= gap * rate; + } const displayHz = this.cutoffHold && this.cutoffMaxHz > 0 ? this.cutoffMaxHz : cutoffHz; const displayBin = Math.round((displayHz / nyquist) * len);