FastLED 3.9.15
Loading...
Searching...
No Matches
fl::audio::detector::KeyDetector Class Reference

Detailed Description

Definition at line 81 of file key.h.

#include <key.h>

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

Public Member Functions

 KeyDetector () FL_NOEXCEPT
 
 ~KeyDetector () FL_NOEXCEPT override
 
void fireCallbacks () override
 
const KeygetCurrentKey () const
 
const char * getName () const override
 
bool hasKey () const
 
bool needsFFT () const override
 
void reset () override
 
void setAveragingFrames (int frames)
 
void setConfidenceThreshold (float threshold)
 
void setMinDuration (u32 ms)
 
void update (shared_ptr< Context > context) override
 
- Public Member Functions inherited from fl::audio::Detector
virtual ~Detector () FL_NOEXCEPT=default
 
virtual bool needsFFTHistory () const FL_NOEXCEPT
 
virtual void setSampleRate (int) FL_NOEXCEPT
 

Public Attributes

function_list< void(const Key &key)> onKey
 
function_list< void(const Key &key)> onKeyChange
 
function_list< void()> onKeyEnd
 

Private Member Functions

float correlateWithProfile (const float *chroma, const float *profile, int rootNote)
 
Key detectKey (const float *chroma, u32 timestamp)
 
void extractChroma (const fft::Bins &fft, float *chroma)
 
void getAveragedChroma (float *chroma)
 
void initializeProfileStats ()
 
void normalizeChroma (float *chroma)
 
void updateChromaHistory (const float *chroma)
 

Private Attributes

int mAveragingFrames
 
vector< float > mChromaHistory [12]
 
float mConfidenceThreshold
 
Key mCurrentKey
 
bool mFireKey = false
 
bool mFireKeyChange = false
 
bool mFireKeyEnd = false
 
int mHistoryIndex
 
int mHistorySize
 
bool mKeyActive
 
u32 mKeyStartTime
 
float mMajorProfileMean = 0.0f
 
float mMajorProfileStdDev = 0.0f
 
u32 mMinKeyDuration
 
float mMinorProfileMean = 0.0f
 
float mMinorProfileStdDev = 0.0f
 
Key mPreviousKey
 
shared_ptr< const fft::BinsmRetainedFFT
 

Static Private Attributes

static const float MAJOR_PROFILE [12]
 
static const float MINOR_PROFILE [12]
 

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