home/ atoms/ fft-value-range-exceeds-one

a.fft values are not clamped to 0–1 and can exceed 1 under normal use, so bounded visual parameters must be clamped in the sketch

After the shim’s dB-to-linear conversion, scaling (default scale=8), and one-pole smoothing, a.fft[i] is nominally in the range 0…~1 but can exceed 1 on loud passages. A moderately loud band typically lands around 0.2–1.2; a strong band can go higher. Visual parameters that must stay in a hard range (e.g. a blend mix 0–1, a color channel 0–1) will overflow and produce artifacts if the raw fft value is used without clamping. The fix is to clamp in the thunk: Math.min(1, base + gain * a.fft[i]).

Examples

blend(() => a.fft[0]) — can exceed 1 and produce overflow. blend(() => Math.min(1, a.fft[0])) — safe. For scale/rotation the overshoot is usually tolerable and can be left unclamped.

Assessment

A Hydra .blend() driven by a.fft[0] occasionally produces a fully-white frame on loud bass hits. Explain the cause and write a corrected thunk.

“**Value range (important for transfer-function design):** `a.fft[i]` is **not** clamped to `0..1`. With `scale = 8` a moderately loud band typically lands around `0.2 … 1.2`”
context/ · L2b-av-link/feature-contract.md · chunk 1