|
FastLED 3.9.15
|
Detects downbeats (first beat of each measure) in music.
The Downbeat analyzes beat patterns to identify the first beat of each musical measure. It detects metric groupings (time signatures) and tracks measure position.
Features:
Dependencies:
Definition at line 33 of file downbeat.h.
#include <downbeat.h>
Inheritance diagram for fl::audio::detector::Downbeat:
Collaboration diagram for fl::audio::detector::Downbeat:Public Member Functions | |
| Downbeat () FL_NOEXCEPT | |
| Construct with standalone Beat. | |
| Downbeat (shared_ptr< Beat > beatDetector) | |
| Construct with shared Beat (recommended) | |
| ~Downbeat () FL_NOEXCEPT override | |
| void | fireCallbacks () override |
| u8 | getBeatsPerMeasure () const |
| Returns detected beats per measure (time signature numerator) | |
| float | getConfidence () const |
| Returns downbeat detection confidence (0-1) | |
| u8 | getCurrentBeat () const |
| Returns current beat number within measure (1-based, 1 = downbeat) | |
| float | getMeasurePhase () const |
| Returns measure phase (0-1, 0 = downbeat) | |
| const char * | getName () const override |
| bool | isDownbeat () const |
| Returns true if downbeat was detected this frame. | |
| bool | needsFFT () const override |
| bool | needsFFTHistory () const override |
| void | reset () override |
| void | setAccentThreshold (float threshold) |
| Set accent detection threshold (default: 1.2) | |
| void | setAutoMeterDetection (bool enable) |
| Enable/disable automatic meter detection (default: true) | |
| void | setBeatDetector (shared_ptr< Beat > beatDetector) |
| Share an external Beat instance. | |
| void | setConfidenceThreshold (float threshold) |
| Set minimum confidence for downbeat detection (default: 0.6) | |
| void | setTimeSignature (u8 beatsPerMeasure) |
| Manually set time signature (disables auto-detection) | |
| 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()> | onDownbeat |
| Fires on detected downbeat (first beat of measure) | |
| function_list< void(u8 beatNumber)> | onMeasureBeat |
| Fires on each beat with beat number (1-based, downbeat = 1) | |
| function_list< void(float phase)> | onMeasurePhase |
| Fires with measure phase each frame (0-1 range) | |
| function_list< void(u8 beatsPerMeasure)> | onMeterChange |
| Fires when time signature changes. | |
Private Member Functions | |
| float | calculateBeatAccent (const fft::Bins &fft, float bassEnergy) |
| bool | detectDownbeat (u32 timestamp, float accent) |
| void | detectMeter () |
| u8 | findMostCommonMeter () const |
| void | updateBeatDetector (shared_ptr< Context > context) |
| void | updateMeasurePhase (u32 timestamp) |
Private Attributes | |
| float | mAccentThreshold |
| bool | mAutoMeterDetection |
| deque< float > | mBeatAccents |
| shared_ptr< Beat > | mBeatDetector |
| u8 | mBeatsPerMeasure |
| u8 | mBeatsSinceDownbeat |
| float | mConfidence |
| float | mConfidenceThreshold |
| u8 | mCurrentBeat |
| bool | mDownbeatDetected |
| bool | mFireDownbeat = false |
| bool | mFireMeasureBeat = false |
| bool | mFireMeterChange = false |
| u32 | mLastBeatTime |
| u32 | mLastDownbeatTime |
| bool | mManualMeter |
| float | mMeasurePhase |
| deque< u8 > | mMeterCandidates |
| bool | mOwnsBeatDetector |
| u8 | mPendingBeatNumber = 0 |
| u8 | mPendingMeter = 0 |
| float | mPreviousEnergy |
| shared_ptr< const fft::Bins > | mRetainedFFT |
Static Private Attributes | |
| static constexpr size | MAX_BEAT_HISTORY = 32 |
| static constexpr size | METER_HISTORY_SIZE = 8 |