Process one audio frame.
- Parameters
-
| onsetDetected | True if onset detector triggered |
| onsetStrength | Onset magnitude (spectral flux value) |
Definition at line 25 of file musical_beat_detector.cpp.hpp.
25 {
29
30 if (!onsetDetected) {
31 return;
32 }
33
35
36
40
41
44
45
46 float ibiSeconds =
static_cast<float>(ibiFrames *
mConfig.samplesPerFrame) /
47 static_cast<float>(
mConfig.sampleRate);
48
49
51
53
55 }
57
58
60
61
63
64
68 } else {
69
72 }
73 } else {
75 }
76}
deque< u32 > mIBIHistory
Inter-beat interval history (in frames)
bool validateBeat(float onsetStrength) FL_NO_EXCEPT
Validate if an onset is a true musical beat.
bool mBeatDetected
Last beat was detected.
float mCurrentBPM
Current BPM estimate (smoothed)
void updateBPMEstimate() FL_NO_EXCEPT
Update BPM estimate from inter-beat intervals.
float mLastBeatConfidence
Last beat confidence score.
u32 mCurrentFrame
Current frame counter.
u32 mLastBeatFrame
Last beat timestamp (in frames)
float getAverageIBI() const FL_NO_EXCEPT
Get inter-beat interval (IBI) statistics.
bool isValidIBI(float ibi) const FL_NO_EXCEPT
Check if IBI is within valid BPM range.
float calculateBeatConfidence(float currentIBI) FL_NO_EXCEPT
Calculate beat confidence based on rhythmic consistency.
MusicalBeatDetectorConfig mConfig
References calculateBeatConfidence(), fl::FL_NO_EXCEPT, getAverageIBI(), isValidIBI(), mBeatDetected, mConfig, mCurrentBPM, mCurrentFrame, mIBIHistory, mLastBeatConfidence, mLastBeatFrame, mStats, updateBPMEstimate(), and validateBeat().
Referenced by ~MusicalBeat().