FastLED 3.9.15
Loading...
Searching...
No Matches

◆ update()

void fl::audio::NoiseFloorTracker::update ( float timedomainLevel,
float frequencydomainLevel = -1.0f )

Update noise floor estimate with new observation.

Parameters
timedomainLevelTime-domain metric (e.g., RMS, peak)
frequencydomainLevelOptional frequency-domain metric (e.g., spectral energy)

Definition at line 36 of file noise_floor_tracker.cpp.hpp.

36 {
37 if (!mConfig.enabled) {
38 return;
39 }
40
41 // Combine time and frequency domain metrics if both provided
42 float combinedLevel = combineDomains(timedomainLevel, frequencydomainLevel);
43
44 // Update statistics
45 if (mStats.samplesProcessed == 0) {
46 mStats.minObserved = combinedLevel;
47 mStats.maxObserved = combinedLevel;
48
49 // Initialize floor to first observed level
50 mCurrentFloor = fl::max(mConfig.minFloor, fl::min(mConfig.maxFloor, combinedLevel));
52 } else {
53 mStats.minObserved = fl::min(mStats.minObserved, combinedLevel);
54 mStats.maxObserved = fl::max(mStats.maxObserved, combinedLevel);
55 }
56 mStats.samplesProcessed++;
57
58 // Update floor based on current observation
59 updateFloor(combinedLevel);
60
61 // Update stats
62 mStats.currentFloor = mCurrentFloor;
63}
float mCurrentFloor
Current noise floor estimate.
void updateFloor(float level) FL_NOEXCEPT
Update floor estimate based on current observation.
NoiseFloorTrackerConfig mConfig
float mLastHysteresisFloor
Floor value at last hysteresis trigger Used to enforce hysteresis margin before allowing floor to ris...
float combineDomains(float timeLevel, float freqLevel) const FL_NOEXCEPT
Calculate combined metric from time and frequency domains.
FL_DISABLE_WARNING_PUSH U constexpr common_type_t< T, U > min(T a, U b) FL_NOEXCEPT
Definition math.h:71
constexpr common_type_t< T, U > max(T a, U b) FL_NOEXCEPT
Definition math.h:75

References combineDomains(), fl::max(), mConfig, mCurrentFloor, fl::min(), mLastHysteresisFloor, mStats, and updateFloor().

Referenced by ~NoiseFloorTracker().

+ Here is the call graph for this function:
+ Here is the caller graph for this function: