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

◆ detectOnset()

bool fl::SpectralFluxDetector::detectOnset ( const float * currentBins,
const float * previousBins )

Definition at line 592 of file audio_reactive.cpp.

592 {
593 float flux = calculateSpectralFlux(currentBins, mPreviousMagnitudes.data());
594
595#if SKETCH_HAS_LOTS_OF_MEMORY
596 // Store flux in history for adaptive threshold calculation
597 mFluxHistory[mHistoryIndex] = flux;
598 mHistoryIndex = (mHistoryIndex + 1) % mFluxHistory.size();
599
600 float adaptiveThreshold = calculateAdaptiveThreshold();
601 return flux > adaptiveThreshold;
602#else
603 // Simple fixed threshold for memory-constrained platforms
604 return flux > mFluxThreshold;
605#endif
606}
float calculateSpectralFlux(const float *currentBins, const float *previousBins)
fl::array< float, 16 > mPreviousMagnitudes

References calculateSpectralFlux(), mFluxThreshold, and mPreviousMagnitudes.

+ Here is the call graph for this function: