this repo has no description
0
fork

Configure Feed

Select the types of activity you want to include in your feed.

remove legacy code

alice 297e2ff3 e6510776

-83
-79
src/ext/cqt.c
··· 414 414 } 415 415 } 416 416 417 - // Process CQT from audio data (using existing FFT data from fftdata.h) 418 - // This is kept for backward compatibility, but not used 419 - void CQT_Process(const float* fftReal, const float* fftImag) 420 - { 421 - if (!cqtFftCfg || !cqtEnabled) return; 422 - 423 - // Apply CQT kernels 424 - CQT_ApplyKernels(fftReal, fftImag); 425 - 426 - // Apply spectral whitening if enabled 427 - #if CQT_SPECTRAL_WHITENING_ENABLED 428 - for (int i = 0; i < CQT_BINS; i++) 429 - { 430 - // Update running average for this bin 431 - cqtBinAverages[i] = cqtBinAverages[i] * CQT_WHITENING_DECAY + 432 - cqtData[i] * (1.0f - CQT_WHITENING_DECAY); 433 - 434 - // Ensure average doesn't go below floor 435 - if (cqtBinAverages[i] < CQT_WHITENING_FLOOR) 436 - cqtBinAverages[i] = CQT_WHITENING_FLOOR; 437 - 438 - // Apply whitening by dividing by the average 439 - cqtWhitenedData[i] = cqtData[i] / cqtBinAverages[i]; 440 - 441 - // Check for NaN or Inf 442 - if (!isfinite(cqtWhitenedData[i])) 443 - cqtWhitenedData[i] = 0.0f; 444 - } 445 - 446 - // Apply smoothing to whitened data 447 - for (int i = 0; i < CQT_BINS; i++) 448 - { 449 - cqtSmoothingData[i] = cqtSmoothingData[i] * CQT_SMOOTHING_FACTOR + 450 - cqtWhitenedData[i] * (1.0f - CQT_SMOOTHING_FACTOR); 451 - } 452 - #else 453 - // Apply smoothing to raw data (spectral whitening disabled) 454 - for (int i = 0; i < CQT_BINS; i++) 455 - { 456 - cqtSmoothingData[i] = cqtSmoothingData[i] * CQT_SMOOTHING_FACTOR + 457 - cqtData[i] * (1.0f - CQT_SMOOTHING_FACTOR); 458 - } 459 - #endif 460 - 461 - // Find peak for normalization 462 - float currentPeak = 0.0f; 463 - for (int i = 0; i < CQT_BINS; i++) 464 - { 465 - if (cqtSmoothingData[i] > currentPeak) 466 - currentPeak = cqtSmoothingData[i]; 467 - } 468 - 469 - // Initialize peak value if needed 470 - if (cqtPeakSmoothValue <= 0.0f) 471 - cqtPeakSmoothValue = 0.1f; 472 - 473 - // Smooth peak value 474 - if (currentPeak > cqtPeakSmoothValue) 475 - cqtPeakSmoothValue = currentPeak; 476 - else 477 - cqtPeakSmoothValue = cqtPeakSmoothValue * 0.99f + currentPeak * 0.01f; 478 - 479 - // Ensure peak value doesn't go too low 480 - if (cqtPeakSmoothValue < 0.0001f) 481 - cqtPeakSmoothValue = 0.0001f; 482 - 483 - // Normalize data 484 - float normalizer = 1.0f / cqtPeakSmoothValue; 485 - for (int i = 0; i < CQT_BINS; i++) 486 - { 487 - cqtNormalizedData[i] = cqtSmoothingData[i] * normalizer; 488 - if (cqtNormalizedData[i] > 1.0f) 489 - cqtNormalizedData[i] = 1.0f; 490 - 491 - // Final NaN check 492 - if (!isfinite(cqtNormalizedData[i])) 493 - cqtNormalizedData[i] = 0.0f; 494 - } 495 - } 496 417 497 418 // Close CQT processing and free resources 498 419 void CQT_Close(void)
-4
src/ext/cqt.h
··· 9 9 // Process CQT from audio buffer (uses shared audio capture buffer) 10 10 void CQT_ProcessAudio(void); 11 11 12 - // Process CQT from FFT data (legacy) 13 - // fftData: Complex FFT output (size should be CQT_FFT_SIZE/2 + 1) 14 - void CQT_Process(const float* fftReal, const float* fftImag); 15 - 16 12 // Close CQT processing and free resources 17 13 void CQT_Close(void); 18 14