MCPcopy Create free account
hub / github.com/FastLED/FastLED / peakBin

Function peakBin

tests/profile/audio/pitch_sweep_test.cpp:55–65  ·  view source on GitHub ↗

--------------------------------------------------------------------------- Helper: find peak bin ---------------------------------------------------------------------------

Source from the content-addressed store, hash-verified

53// Helper: find peak bin
54// ---------------------------------------------------------------------------
55static int peakBin(fl::span<const float> bins) {
56 int best = 0;
57 float bestVal = 0.0f;
58 for (int i = 0; i < static_cast<int>(bins.size()); i++) {
59 if (bins[i] > bestVal) {
60 bestVal = bins[i];
61 best = i;
62 }
63 }
64 return best;
65}
66
67// ---------------------------------------------------------------------------
68// Helper: energy concentration in peak ±1 bins (fraction of total energy)

Callers 1

runSweepFunction · 0.70

Calls 1

sizeMethod · 0.45

Tested by

no test coverage detected