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

◆ detectOnset()

bool fl::audio::SpectralFluxDetector::detectOnset ( span< const float, 16 > currentBins)

Definition at line 799 of file audio_reactive.cpp.hpp.

799 {
800 float flux = calculateSpectralFlux(currentBins, span<const float, 16>(mPreviousMagnitudes.data(), 16));
801
802#if SKETCH_HAS_LARGE_MEMORY
803 // Store flux in history for adaptive threshold calculation
804 mFluxHistory[mHistoryIndex] = flux;
805 mHistoryIndex = (mHistoryIndex + 1) % mFluxHistory.size();
806
807 float adaptiveThreshold = calculateAdaptiveThreshold();
808 return flux > adaptiveThreshold;
809#else
810 // Simple fixed threshold for memory-constrained platforms
811 return flux > mFluxThreshold;
812#endif
813}
float calculateSpectralFlux(span< const float, 16 > currentBins, span< const float, 16 > previousBins)
fl::array< float, 16 > mPreviousMagnitudes

References calculateSpectralFlux(), mFluxThreshold, and mPreviousMagnitudes.

Referenced by ~SpectralFluxDetector().

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