FastLED 3.10.8
Loading...
Searching...
No Matches
fl::audio::detector::TempoAnalyzer Class Reference

Detailed Description

Definition at line 15 of file tempo_analyzer.h.

#include <tempo_analyzer.h>

+ Inheritance diagram for fl::audio::detector::TempoAnalyzer:
+ Collaboration diagram for fl::audio::detector::TempoAnalyzer:

Classes

struct  TempoHypothesis
 

Public Member Functions

 TempoAnalyzer () FL_NO_EXCEPT
 
 ~TempoAnalyzer () FL_NO_EXCEPT override
 
float calculateIntervalScore (u32 interval) FL_NO_EXCEPT
 
void fireCallbacks () FL_NO_EXCEPT override
 
float getBPM () const FL_NO_EXCEPT
 
float getConfidence () const FL_NO_EXCEPT
 
const char * getName () const FL_NO_EXCEPT override
 
float getStability () const FL_NO_EXCEPT
 
bool isStable () const FL_NO_EXCEPT
 
bool needsFFT () const FL_NO_EXCEPT override
 
bool needsFFTHistory () const FL_NO_EXCEPT override
 
void reset () FL_NO_EXCEPT override
 
void setMaxBPM (float maxBPM) FL_NO_EXCEPT
 
void setMinBPM (float minBPM) FL_NO_EXCEPT
 
void setStabilityThreshold (float threshold) FL_NO_EXCEPT
 
void update (shared_ptr< Context > context) FL_NO_EXCEPT override
 
- Public Member Functions inherited from fl::audio::Detector
virtual ~Detector () FL_NO_EXCEPT=default
 
virtual void setSampleRate (int) FL_NO_EXCEPT
 

Public Attributes

function_list< void(float bpm)> onTempo
 
function_list< void(float bpm)> onTempoChange
 
function_list< void()> onTempoStable
 
function_list< void()> onTempoUnstable
 
function_list< void(float bpm, float confidence)> onTempoWithConfidence
 

Private Member Functions

float calculateSpectralFlux (const fft::Bins &fft) FL_NO_EXCEPT
 
float calculateTempoConfidence (const TempoHypothesis &hyp) FL_NO_EXCEPT
 
bool detectOnset (u32 timestamp) FL_NO_EXCEPT
 
void pruneHypotheses () FL_NO_EXCEPT
 
void updateAdaptiveThreshold () FL_NO_EXCEPT
 
void updateCurrentTempo () FL_NO_EXCEPT
 
void updateHypotheses (u32 timestamp) FL_NO_EXCEPT
 
void updateStability () FL_NO_EXCEPT
 

Private Attributes

float mAdaptiveThreshold
 
bool mBpmChanged = false
 
deque< float > mBPMHistory
 
MedianFilter< float, 21 > mBPMMedian
 
float mConfidence
 
SilenceEnvelope mConfidenceEnvelope
 
float mCurrentBPM
 
MovingAverage< float, 43 > mFluxAvg
 
bool mHasPrevTimestamp = false
 
vector< TempoHypothesis > mHypotheses
 
bool mIsStable
 
float mMaxBPM
 
float mMinBPM
 
deque< u32 > mOnsetTimes
 
float mPreviousBPM = 120.0f
 
float mPreviousFlux
 
vector< float > mPreviousMagnitudes
 
u32 mPrevTimestamp = 0
 
shared_ptr< const fft::Bins > mRetainedFFT
 
float mStability
 
float mStabilityThreshold
 
u32 mStableFrameCount
 
bool mWasStable = false
 

Static Private Attributes

static constexpr size BPM_HISTORY_SIZE = 20
 
static constexpr size FLUX_HISTORY_SIZE = 43
 
static constexpr u32 MAX_BEAT_INTERVAL_MS = 2000
 
static constexpr size MAX_HYPOTHESES = 5
 
static constexpr size MAX_ONSET_HISTORY = 50
 
static constexpr u32 MIN_BEAT_INTERVAL_MS = 250
 
static constexpr u32 STABLE_FRAMES_REQUIRED = 10
 

The documentation for this class was generated from the following files: