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

◆ resolveModeEnums()

void fl::audio::fft::Args::resolveModeEnums ( Mode & mode,
Window & window,
int bands,
int samples,
float fmin,
float fmax )
static

Definition at line 265 of file fft.cpp.hpp.

266 {
267 // Resolve mode first
268 if (mode == Mode::AUTO) {
269 if (bands <= 32) {
271 } else {
272 // Check kernel conditioning: N_window = N * fmin / fmax.
273 // When >= 2, CQ_NAIVE (single FFT + kernels) works well.
274 // When < 2, kernels degenerate and we need octave-wise CQT.
275 int winMin = static_cast<int>(
276 static_cast<float>(samples) * fmin / fmax);
277 mode = (winMin >= 2) ? Mode::CQ_NAIVE : Mode::CQ_OCTAVE;
278 }
279 }
280
281 // Resolve window based on resolved mode
282 if (window == Window::AUTO) {
283 switch (mode) {
284 case Mode::LOG_REBIN:
285 case Mode::CQ_HYBRID:
286 // These paths apply time-domain windowing before fft::FFT.
287 // BLACKMAN_HARRIS: -92 dB sidelobe rejection (vs -31 dB HANNING).
288 // Sidelobes produce only mag=0-1 quantization noise, ensuring
289 // distant output bins have near-zero energy (≤2) for pure tones.
290 // Main lobe is 8 FFT bins wide (~690 Hz at 512/44100), so
291 // output bins narrower than ~130 Hz may see main lobe leakage
292 // at distance 3+ — a fundamental resolution limit.
294 break;
295 case Mode::CQ_NAIVE:
296 case Mode::CQ_OCTAVE:
297 // CQ kernels already apply Hamming windowing in frequency domain.
298 // No time-domain window is applied on these paths, so this is
299 // cosmetic. HANNING is the lighter/cheaper default.
301 break;
302 default:
304 break;
305 }
306 }
307}

References fl::audio::fft::AUTO, bands, fl::audio::fft::BLACKMAN_HARRIS, fl::audio::fft::CQ_HYBRID, fl::audio::fft::CQ_NAIVE, fl::audio::fft::CQ_OCTAVE, fmax, fmin, fl::audio::fft::HANNING, fl::audio::fft::LOG_REBIN, mode, samples, and window.

Referenced by fl::audio::fft::Context::Context().

+ Here is the caller graph for this function: