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

◆ calculateHighFreqEnergy() [2/2]

float fl::audio::detector::Transient::calculateHighFreqEnergy ( const fft::Bins & fft)
private

Definition at line 85 of file transient.cpp.hpp.

85 {
86 // Focus on mid-high to high frequencies (bins 4-15) for transient detection
87 // Low frequencies tend to have slower attack times
88 float energy = 0.0f;
89 size numBins = fft.raw().size();
90
91 // Weight higher frequencies more for transient detection
92 for (size i = 4; i < numBins; i++) {
93 float weight = static_cast<float>(i) / static_cast<float>(numBins);
94 energy += fft.raw()[i] * (1.0f + weight);
95 }
96
97 size validBins = (numBins > 4) ? (numBins - 4) : 1;
98 return energy / static_cast<float>(validBins);
99}
AudioAnalyzeFFT1024 fft

References fl::FL_NO_EXCEPT.

Referenced by update().

+ Here is the caller graph for this function: