FastLED 3.9.15
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_NOEXCEPT
 
 ~Beat () FL_NOEXCEPT override
 
void fireCallbacks () override
 
float getBPM () const
 
float getConfidence () const
 
const char * getName () const override
 
float getPhase () const
 
bool isBeat () const
 
bool needsFFT () const override
 
bool needsFFTHistory () const override
 
void reset () override
 
void setSensitivity (float sensitivity)
 
void setThreshold (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()> 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)
 
bool detectBeat (u32 timestamp)
 
void updateAdaptiveThreshold ()
 
void updatePhase (u32 timestamp)
 
void updateTempo (u32 timestamp)
 

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