mirror of
https://codeberg.org/armin/tcdweb.git
synced 2026-09-01 05:30:45 +02:00
Add cutoff max falloff decay selector
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.
This commit is contained in:
parent
e159b76e0d
commit
1972add309
2 changed files with 13 additions and 0 deletions
|
|
@ -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);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue