|
FastLED 3.9.15
|
SpectralEqualizer applies frequency-dependent gain correction to address mid-frequency dominance and provide perceptual weighting of audio spectra.
Common use cases:
The equalizer operates on frequency bins produced by FrequencyBinMapper and applies configurable gain curves to reshape the spectrum before beat detection and visual processing.
Usage:
Definition at line 76 of file spectral_equalizer.h.
#include <spectral_equalizer.h>
Collaboration diagram for fl::audio::SpectralEqualizer:Classes | |
| struct | Stats |
| Get statistics (for debugging/monitoring) More... | |
Public Member Functions | |
| SpectralEqualizer () FL_NOEXCEPT | |
| SpectralEqualizer (const SpectralEqualizerConfig &config) | |
| ~SpectralEqualizer () FL_NOEXCEPT | |
| void | apply (span< const float > inputBins, span< float > outputBins) const |
| Apply equalization to frequency bins. | |
| void | configure (const SpectralEqualizerConfig &config) |
| Configure the spectral equalizer This calculates per-band gain multipliers based on the selected curve. | |
| const SpectralEqualizerConfig & | getConfig () const |
| Get current configuration. | |
| span< const float > | getGains () const |
| Get current per-band gains. | |
| const Stats & | getStats () const |
| void | resetStats () |
| Reset statistics. | |
| void | setCustomGains (span< const float > gains) |
| Set custom per-band gains (switches to Custom curve) | |
Private Member Functions | |
| float | applyCompression (float value) const |
| Apply dynamic range compression per band. | |
| void | calculateAWeightingGains () |
| Calculate A-weighting gains. | |
| void | calculateFlatGains () |
| Calculate flat gains (all 1.0) | |
| void | calculateGains () |
| Calculate gains based on current curve. | |
| float | calculateMakeupGain (span< const float > inputBins, span< const float > outputBins) const |
| Calculate makeup gain to maintain target level. | |
Private Attributes | |
| SpectralEqualizerConfig | mConfig |
| vector< float > | mGains |
| Per-band gain multipliers. | |
| Stats | mStats |
Static Private Attributes | |
| static constexpr float | A_WEIGHTING_16BAND [16] |
| A-weighting coefficients for 16-band frequency analysis These approximate the A-weighting curve across logarithmic frequency bins Values emphasize 1-6 kHz range where human hearing is most sensitive. | |
| static constexpr float | A_WEIGHTING_32BAND [32] |
| A-weighting coefficients for 32-band frequency analysis. | |