MCPcopy Create free account
hub / github.com/FastLED/FastLED / getBassEnergy

Method getBassEnergy

src/fl/audio/detector/drop.cpp.hpp:109–119  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

107}
108
109float DropDetector::getBassEnergy(const fft::Bins& fft) const {
110 // Bass = first 25% of bins (sub-bass and bass)
111 int endBin = fl::max(1, static_cast<int>(fft.raw().size() / 4));
112 float energy = 0.0f;
113
114 for (int i = 0; i < endBin; i++) {
115 energy += fft.raw()[i];
116 }
117
118 return energy / static_cast<float>(endBin);
119}
120
121float DropDetector::getMidEnergy(const fft::Bins& fft) const {
122 // Mid = middle 50% of bins (midrange frequencies)

Callers 3

FL_TEST_FILEFunction · 0.45

Calls 3

maxFunction · 0.85
sizeMethod · 0.45
rawMethod · 0.45

Tested by

no test coverage detected