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

Detailed Description

Definition at line 13 of file beat.h.

#include <beat.h>

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

Public Member Functions

 Beat () FL_NO_EXCEPT
 
 ~Beat () FL_NO_EXCEPT override
 
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 getPhase () const FL_NO_EXCEPT
 
bool isBeat () 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 setSensitivity (float sensitivity) FL_NO_EXCEPT
 
void setThreshold (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()> onBeat
 
function_list< void(float phase)> onBeatPhase
 
function_list< void(float strength)> onOnset
 
function_list< void(float bpm, float confidence)> onTempoChange
 

Private Member Functions

float calculateSpectralFlux (const fft::Bins &fft) FL_NO_EXCEPT
 
bool detectBeat (u32 timestamp) FL_NO_EXCEPT
 
void updateAdaptiveThreshold () FL_NO_EXCEPT
 
void updatePhase (u32 timestamp) FL_NO_EXCEPT
 
void updateTempo (u32 timestamp) FL_NO_EXCEPT
 

Private Attributes

float mAdaptiveThreshold
 
bool mBeatDetected
 
u32 mBeatInterval
 
float mBPM
 
float mConfidence
 
MovingAverage< float, 43 > mFluxAvg
 
u32 mLastBeatTime
 
float mPhase
 
vector< float > mPreviousMagnitudes
 
shared_ptr< const fft::Bins > mRetainedFFT
 
float mSensitivity
 
float mSpectralFlux
 
bool mTempoChanged = false
 
float mThreshold
 

Static Private Attributes

static constexpr size FLUX_HISTORY_SIZE = 43
 
static constexpr u32 MAX_BEAT_INTERVAL_MS = 2000
 
static constexpr u32 MIN_BEAT_INTERVAL_MS = 250
 

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