67 bool needsFFT()
const override {
return true; }
69 const char*
getName()
const override {
return "Backbeat"; }
70 void reset()
override;
75 function_list<void(
u8 beatNumber,
float confidence,
float strength)>
onBackbeat;
void setDownbeatDetector(shared_ptr< Downbeat > downbeatDetector)
Share an external Downbeat instance.
bool needsFFT() const override
shared_ptr< Beat > mBeatDetector
void setBackbeatExpectedBeats(u8 beatMask)
Set which beats are backbeats using bitmask (bit 0=beat 1, bit 1=beat 2, etc.)
void fireCallbacks() override
void update(shared_ptr< Context > context) override
MultibandAccent calculateMultibandAccent(const fft::Bins &fft)
float detectBackbeatAccent(const MultibandAccent &accent)
void setAdaptive(bool enable)
Enable/disable adaptive threshold learning (default: true)
void updateAdaptiveThresholds()
void setMidThreshold(float threshold)
Set mid accent threshold (default: 1.3) - critical for snare.
u8 getLastBackbeatNumber() const
Returns the beat number of the last detected backbeat (1-based)
deque< float > mBackbeatAccents
void setHighThreshold(float threshold)
Set high accent threshold (default: 1.1)
MultibandAccent mPreviousAccent
bool isBackbeat() const
Returns true if backbeat was detected this frame.
void setBeatDetector(shared_ptr< Beat > beatDetector)
Share an external Beat instance.
float getConfidence() const
Returns backbeat detection confidence (0-1)
float getBackbeatRatio() const
Returns ratio of backbeat to downbeat energy (0-2+)
static constexpr size MAX_ACCENT_HISTORY
function_list< void(u8 beatNumber, float confidence, float strength)> onBackbeat
Fires on detected backbeat (beats 2, 4) with beat number, confidence, and strength.
bool detectBackbeat(float accentStrength, const fft::Bins &fft)
void updateBeatDetector(shared_ptr< Context > context)
bool isBackbeatPosition() const
float calculatePatternConfidence(const fft::Bins &fft)
vector< float > mBackbeatSpectralProfile
void setBassThreshold(float threshold)
Set bass accent threshold (default: 1.2)
float getStrength() const
Returns current backbeat accent strength (0-1+)
~Backbeat() FL_NOEXCEPT override
shared_ptr< Downbeat > mDownbeatDetector
const char * getName() const override
float mConfidenceThreshold
shared_ptr< const fft::Bins > mRetainedFFT
bool mOwnsDownbeatDetector
void updateBackbeatProfile(const fft::Bins &fft)
Backbeat() FL_NOEXCEPT
Construct with standalone Beat.
bool needsFFTHistory() const override
static constexpr size SPECTRAL_PROFILE_SIZE
Backbeat(shared_ptr< Beat > beatDetector)
Construct with shared Beat.
void updateBeatPosition()
deque< float > mNonBackbeatAccents
void setConfidenceThreshold(float threshold)
Set minimum confidence for backbeat detection (default: 0.6)
Multi-band accent information for backbeat detection.
Base definition for an LED controller.