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

◆ calculateTempoConfidence()

float fl::audio::detector::TempoAnalyzer::calculateTempoConfidence ( const TempoHypothesis & hyp)
private

Definition at line 324 of file tempo_analyzer.cpp.hpp.

324 {
325 // Confidence based on:
326 // 1. Hypothesis score
327 // 2. Number of onsets supporting it
328 // 3. Stability
329
330 float scoreComponent = fl::min(1.0f, hyp.score);
331 float onsetComponent = fl::min(1.0f, static_cast<float>(hyp.onsetCount) / 10.0f);
332 float stabilityComponent = mStability;
333
334 return (scoreComponent * 0.4f + onsetComponent * 0.3f + stabilityComponent * 0.3f);
335}
FL_DISABLE_WARNING_PUSH U constexpr common_type_t< T, U > min(T a, U b) FL_NOEXCEPT
Definition math.h:71

References fl::min(), mStability, fl::audio::detector::TempoAnalyzer::TempoHypothesis::onsetCount, and fl::audio::detector::TempoAnalyzer::TempoHypothesis::score.

Referenced by updateCurrentTempo().

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