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

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)
 
float calculateTempoConfidence (const TempoHypothesis &hyp)
 
bool detectOnset (u32 timestamp)
 
void pruneHypotheses ()
 
void updateAdaptiveThreshold ()
 
void updateCurrentTempo ()
 
void updateHypotheses (u32 timestamp)
 
void updateStability ()
 

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< TempoHypothesismHypotheses
 
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::BinsmRetainedFFT
 
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: