|
FastLED 3.9.15
|
Detects backbeats (beats 2 and 4 in 4/4 time) in music.
The Backbeat identifies backbeat patterns using multi-band frequency analysis with emphasis on mid-range frequencies where snare drums are prominent. It complements the Downbeat and is crucial for rock, pop, funk, and many other genres where the snare drum emphasizes the backbeat.
Features:
Dependencies:
Definition at line 45 of file backbeat.h.
#include <backbeat.h>
Inheritance diagram for fl::audio::detector::Backbeat:
Collaboration diagram for fl::audio::detector::Backbeat:Public Member Functions | |
| Backbeat () FL_NOEXCEPT | |
| Construct with standalone Beat. | |
| Backbeat (shared_ptr< Beat > beatDetector) | |
| Construct with shared Beat. | |
| Backbeat (shared_ptr< Beat > beatDetector, shared_ptr< Downbeat > downbeatDetector) | |
| Construct with shared Beat and Downbeat. | |
| ~Backbeat () FL_NOEXCEPT override | |
| void | fireCallbacks () override |
| float | getBackbeatRatio () const |
| Returns ratio of backbeat to downbeat energy (0-2+) | |
| float | getConfidence () const |
| Returns backbeat detection confidence (0-1) | |
| u8 | getLastBackbeatNumber () const |
| Returns the beat number of the last detected backbeat (1-based) | |
| const char * | getName () const override |
| float | getStrength () const |
| Returns current backbeat accent strength (0-1+) | |
| bool | isBackbeat () const |
| Returns true if backbeat was detected this frame. | |
| bool | needsFFT () const override |
| bool | needsFFTHistory () const override |
| void | reset () override |
| void | setAdaptive (bool enable) |
| Enable/disable adaptive threshold learning (default: true) | |
| void | setBackbeatExpectedBeats (u8 beatMask) |
| Set which beats are backbeats using bitmask (bit 0=beat 1, bit 1=beat 2, etc.) | |
| void | setBassThreshold (float threshold) |
| Set bass accent threshold (default: 1.2) | |
| void | setBeatDetector (shared_ptr< Beat > beatDetector) |
| Share an external Beat instance. | |
| void | setConfidenceThreshold (float threshold) |
| Set minimum confidence for backbeat detection (default: 0.6) | |
| void | setDownbeatDetector (shared_ptr< Downbeat > downbeatDetector) |
| Share an external Downbeat instance. | |
| void | setHighThreshold (float threshold) |
| Set high accent threshold (default: 1.1) | |
| void | setMidThreshold (float threshold) |
| Set mid accent threshold (default: 1.3) - critical for snare. | |
| 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(u8 beatNumber, float confidence, float strength)> | onBackbeat |
| Fires on detected backbeat (beats 2, 4) with beat number, confidence, and strength. | |
Private Member Functions | |
| MultibandAccent | calculateMultibandAccent (const fft::Bins &fft) |
| float | calculatePatternConfidence (const fft::Bins &fft) |
| bool | detectBackbeat (float accentStrength, const fft::Bins &fft) |
| float | detectBackbeatAccent (const MultibandAccent &accent) |
| bool | isBackbeatPosition () const |
| void | updateAdaptiveThresholds () |
| void | updateBackbeatProfile (const fft::Bins &fft) |
| void | updateBeatDetector (shared_ptr< Context > context) |
| void | updateBeatPosition () |
Private Attributes | |
| bool | mAdaptive |
| float | mAdaptiveThreshold |
| deque< float > | mBackbeatAccents |
| bool | mBackbeatDetected |
| u8 | mBackbeatMask |
| float | mBackbeatMean |
| float | mBackbeatRatio |
| vector< float > | mBackbeatSpectralProfile |
| float | mBassThreshold |
| shared_ptr< Beat > | mBeatDetector |
| u8 | mBeatsPerMeasure |
| float | mConfidence |
| float | mConfidenceThreshold |
| u8 | mCurrentBeat |
| float | mCurrentStrength |
| shared_ptr< Downbeat > | mDownbeatDetector |
| float | mHighThreshold |
| u8 | mLastBackbeatNumber |
| float | mMidThreshold |
| deque< float > | mNonBackbeatAccents |
| float | mNonBackbeatMean |
| bool | mOwnsBeatDetector |
| bool | mOwnsDownbeatDetector |
| MultibandAccent | mPreviousAccent |
| bool | mPreviousWasBeat |
| float | mProfileAlpha |
| shared_ptr< const fft::Bins > | mRetainedFFT |
Static Private Attributes | |
| static constexpr size | MAX_ACCENT_HISTORY = 16 |
| static constexpr size | SPECTRAL_PROFILE_SIZE = 16 |