FastLED 3.10.8
Loading...
Searching...
No Matches

◆ getTrebleEnergy()

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

Get treble energy (average of bins 14-15 in 16-bin mode)

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

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

192 {
193 if (frequencyBins.size() < TREBLE_BIN_END) {
194 return 0.0f;
195 }
196
197 // Average bins 14-15 (treble range)
198 float sum = 0.0f;
199 for (size i = TREBLE_BIN_START; i < TREBLE_BIN_END; ++i) {
200 sum += frequencyBins[i];
201 }
202 return sum / static_cast<float>(TREBLE_BIN_END - TREBLE_BIN_START);
203}
static constexpr size TREBLE_BIN_START

References fl::FL_NO_EXCEPT, TREBLE_BIN_END, and TREBLE_BIN_START.

Referenced by ~FrequencyBinMapper().

+ Here is the caller graph for this function: