|
FastLED 3.9.15
|
MultiBandBeat performs frequency-specific beat detection.
This class separates beat detection into three frequency bands:
Features:
Usage:
Definition at line 74 of file multiband_beat_detector.h.
#include <multiband_beat_detector.h>
Collaboration diagram for fl::audio::detector::MultiBandBeat:Classes | |
| struct | Stats |
| Get statistics (for debugging/monitoring) More... | |
Public Member Functions | |
| MultiBandBeat () FL_NOEXCEPT | |
| MultiBandBeat (const MultiBandBeatDetectorConfig &config) | |
| ~MultiBandBeat () FL_NOEXCEPT | |
| void | configure (const MultiBandBeatDetectorConfig &config) |
| Configure the multi-band beat detector. | |
| void | detectBeats (span< const float > frequencyBins) |
| Detect beats in all frequency bands. | |
| float | getBassEnergy () const |
| Get current bass energy (0.0-1.0) | |
| float | getMidEnergy () const |
| Get current mid energy (0.0-1.0) | |
| const Stats & | getStats () const |
| float | getTrebleEnergy () const |
| Get current treble energy (0.0-1.0) | |
| bool | isBassBeat () const |
| Check if a bass beat was detected in the last frame. | |
| bool | isMidBeat () const |
| Check if a mid beat was detected in the last frame. | |
| bool | isMultiBandBeat () const |
| Check if multiple bands triggered simultaneously (strong beat) | |
| bool | isTrebleBeat () const |
| Check if a treble beat was detected in the last frame. | |
| void | reset () |
| Reset internal state (clear history, reset cooldowns) | |
Private Member Functions | |
| float | calculateBassEnergy (span< const float > frequencyBins) const |
| Calculate energy for bass band (bins 0-1) | |
| float | calculateMidEnergy (span< const float > frequencyBins) const |
| Calculate energy for mid band (bins 6-7) | |
| float | calculateTrebleEnergy (span< const float > frequencyBins) const |
| Calculate energy for treble band (bins 14-15) | |
| bool | detectBandBeat (float currentEnergy, float previousEnergy, float threshold, u32 &cooldownCounter) |
| Detect beat in a specific frequency band. | |
Private Attributes | |
| bool | mBassBeat = false |
| Beat detection flags for current frame. | |
| u32 | mBassCooldown = 0 |
| Beat cooldown counters (prevent double-triggering) | |
| float | mBassEnergy = 0.0f |
| Current band energies. | |
| MultiBandBeatDetectorConfig | mConfig |
| u32 | mCurrentFrame = 0 |
| Current frame counter. | |
| bool | mMidBeat = false |
| u32 | mMidCooldown = 0 |
| float | mMidEnergy = 0.0f |
| float | mPreviousBassEnergy = 0.0f |
| Previous band energies (for energy increase calculation) | |
| float | mPreviousMidEnergy = 0.0f |
| float | mPreviousTrebleEnergy = 0.0f |
| Stats | mStats |
| bool | mTrebleBeat = false |
| u32 | mTrebleCooldown = 0 |
| float | mTrebleEnergy = 0.0f |
Static Private Attributes | |
| static constexpr size | BASS_BIN_END = 2 |
| static constexpr size | BASS_BIN_START = 0 |
| Frequency bin indices for each band. | |
| static constexpr size | MID_BIN_END = 8 |
| static constexpr size | MID_BIN_START = 6 |
| static constexpr size | TREBLE_BIN_END = 16 |
| static constexpr size | TREBLE_BIN_START = 14 |