| 147 | } |
| 148 | |
| 149 | void TempoAnalyzer::updateAdaptiveThreshold() { |
| 150 | // O(1) running average via MovingAverage filter |
| 151 | float mean = mFluxAvg.update(mPreviousFlux); |
| 152 | mAdaptiveThreshold = mean * 1.5f; |
| 153 | } |
| 154 | |
| 155 | bool TempoAnalyzer::detectOnset(u32 timestamp) { |
| 156 | // Simple onset detection: flux exceeds adaptive threshold |