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

◆ getAverageIBI()

float fl::audio::detector::MusicalBeat::getAverageIBI ( ) const

Get inter-beat interval (IBI) statistics.

Returns
Average IBI in seconds (time between beats)

Definition at line 90 of file musical_beat_detector.cpp.hpp.

90 {
91 if (mIBIHistory.empty()) {
92 return 0.0f;
93 }
94
95 u32 sum = 0;
96 for (size i = 0; i < mIBIHistory.size(); ++i) {
97 sum += mIBIHistory[i];
98 }
99
100 float avgFrames = static_cast<float>(sum) / static_cast<float>(mIBIHistory.size());
101 return (avgFrames * static_cast<float>(mConfig.samplesPerFrame)) /
102 static_cast<float>(mConfig.sampleRate);
103}
deque< u32 > mIBIHistory
Inter-beat interval history (in frames)

References mConfig, and mIBIHistory.

Referenced by ~MusicalBeat(), calculateBeatConfidence(), processSample(), and updateBPMEstimate().

+ Here is the caller graph for this function: