FastLED 3.9.15
Loading...
Searching...
No Matches

◆ getBassEnergy()

float fl::audio::FrequencyBinMapper::getBassEnergy ( span< const float > frequencyBins) const

Get bass energy (average of bins 0-1 in 16-bin mode)

Parameters
frequencyBinsFrequency bins from mapBins()
Returns
Average bass energy (0.0-1.0 normalized)

Definition at line 167 of file frequency_bin_mapper.cpp.hpp.

167 {
168 if (frequencyBins.size() < BASS_BIN_END) {
169 return 0.0f;
170 }
171
172 // Average bins 0-1 (bass range)
173 float sum = 0.0f;
174 for (size i = BASS_BIN_START; i < BASS_BIN_END; ++i) {
175 sum += frequencyBins[i];
176 }
177 return sum / static_cast<float>(BASS_BIN_END - BASS_BIN_START);
178}
static constexpr size BASS_BIN_START
Bass/mid/treble bin indices (for 16-bin mode) These are pre-calculated based on the bin count.

References BASS_BIN_END, BASS_BIN_START, and fl::span< T, Extent >::size().

Referenced by ~FrequencyBinMapper().

+ Here is the call graph for this function:
+ Here is the caller graph for this function: