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

◆ applyCrossBandRejection()

void fl::audio::detector::Percussion::applyCrossBandRejection ( )
private

Definition at line 314 of file percussion.cpp.hpp.

314 {
315 // Winner-takes-all among competing types.
316 // With frequency-based bands (90-14080 Hz), kick and tom have similar
317 // bass/treble ratios. Use sub-bass proxy as primary discriminant.
318
319 // Kick vs Tom: both have moderate bass. Sub-bass proxy separates them.
320 // Kick has sub-bass body resonance (subBassProxy > 0.5), tom doesn't.
321 if (mBassToTotal > 0.20f) {
322 if (mSubBassProxy > 0.5f) {
323 // Sub-bass present → kick-like, suppress tom
324 mTomConfidence *= 0.3f;
325 } else if (mSubBassProxy < 0.3f) {
326 // No sub-bass → tom-like, suppress kick
327 mKickConfidence *= 0.3f;
328 }
329 }
330
331 // HiHat vs Snare: both have high treble. Discriminate by bass content.
332 if (mTrebleToTotal > 0.60f && mBassToTotal < 0.12f) {
333 mSnareConfidence *= 0.3f;
334 }
335
336 // Crash/broadband rejection: very high treble with no bass
337 if (mTrebleToTotal > 0.70f && mBassToTotal < 0.10f) {
338 mSnareConfidence *= 0.3f;
339 mKickConfidence *= 0.2f;
340 mTomConfidence *= 0.2f;
341 }
342
343 // Noise rejection: white noise has very low treble flatness (< 0.50)
345 mSnareConfidence *= 0.3f;
346 }
347
348 // Very high click ratio + high treble → hi-hat, not snare
349 if (mClickRatio > 3.0f && mTrebleToTotal > 0.60f) {
350 mSnareConfidence *= 0.3f;
351 }
352}

References mBassToTotal, mClickRatio, mKickConfidence, mSnareConfidence, mSubBassProxy, mTomConfidence, mTrebleFlatness, and mTrebleToTotal.

Referenced by update().

+ Here is the caller graph for this function: