FastLED 3.9.15
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 193 of file frequency_bin_mapper.cpp.hpp.

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

References fl::span< T, Extent >::size(), TREBLE_BIN_END, and TREBLE_BIN_START.

Referenced by ~FrequencyBinMapper().

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