Skip to content

feat: FFT smoothing attack also - #637

Merged
alnitak merged 4 commits into
mainfrom
fft-smoothing-attack
Dec 5, 2026
Merged

alnitak merged 4 commits into
mainfrom
fft-smoothing-attack

Conversation

@alnitak

@alnitak alnitak commented Dec 5, 2026 •

Copy link
Copy Markdown
Owner

Description

setFftSmoothing gains an optional attack, the smoothing factor for a bin that rises. The first argument, smooth, is now the factor for a bin that falls (the decay).

SoLoud.instance.setFftSmoothing(0.9);              // falls slowly, rises at once
SoLoud.instance.setFftSmoothing(0.8, attack: 0.5); // a softer rise too
SoLoud.instance.setFftSmoothing(0.8, attack: 0.8); // as before this PR

Behaviour change

Until now one factor smoothed rises and falls alike, as the Web Audio AnalyserNode does. attack is 0 when left out, so the default (0.8) and every existing setFftSmoothing(x) call now smooth the falls only: a bin jumps to a louder value at once and then sinks back. Pass attack equal to smooth for the previous look.

No call site breaks, as attack is a named optional parameter. Every call sets both factors, so a call without attack sets the attack back to 0.

Type of Change

  • ✨ New feature (non-breaking change which adds functionality)

setFftSmoothing(smooth, attack: ...) smooths a bin that rises with a
factor of its own. smooth is the factor for a bin that falls.

The attack is 0 when left out, so the default of 0.8 and a call without
attack now smooth the falls only. Before, one factor smoothed rises and
falls alike: pass attack equal to smooth for that.
Seven blocks were under SOLOUD_SIMD_ENABLED, which nothing defines: four
in the analyzer, one each in the amplitude modulator, pitch shift and
parametric EQ filters. They could not compile (f32x4 has no operators),
and two passed fma its arguments in the wrong order.

The plain loops below them did the work and still do: with -O3 the
compiler vectorizes them by itself.
@alnitak
alnitak merged commit ea0b83c into main Dec 5, 2026
1 check passed
@alnitak
alnitak deleted the fft-smoothing-attack branch December 5, 2026 11:59
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant