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

◆ getMidEnergy()

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

Get mid energy (average of bins 6-7 in 16-bin mode)

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

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

180 {
181 if (frequencyBins.size() < MID_BIN_END) {
182 return 0.0f;
183 }
184
185 // Average bins 6-7 (mid range)
186 float sum = 0.0f;
187 for (size i = MID_BIN_START; i < MID_BIN_END; ++i) {
188 sum += frequencyBins[i];
189 }
190 return sum / static_cast<float>(MID_BIN_END - MID_BIN_START);
191}

References MID_BIN_END, MID_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: