837 {
838 float logRatio =
logf(fmax / fmin);
839
840
842 for (int i = 0; i < bands; i++) {
843 centerFreqs[i] =
844 fmin *
expf(logRatio *
static_cast<float>(i) /
845 static_cast<float>(bands - 1));
846 }
847
848
849
850
851 float bassMidFreq = fmin * 4.0f;
852 float midUpperFreq = fmin * 8.0f;
853
854
855 if (midUpperFreq >= fmax) midUpperFreq = fmax * 0.5f;
856 if (bassMidFreq >= midUpperFreq) bassMidFreq = midUpperFreq * 0.5f;
857
858
860 for (int i = 0; i < bands; i++) {
861 if (centerFreqs[i] < bassMidFreq)
863 }
866 if (centerFreqs[i] < midUpperFreq)
868 }
869
870
876
877
879 if (bands <= 1) {
882 } else {
883 float denom = 2.0f * static_cast<float>(bands - 1);
885 for (int i = 1; i < bands; i++) {
887 fmin *
expf(logRatio *
888 (2.0f * static_cast<float>(i) - 1.0f) / denom);
889 }
891 }
892
893
894 float nyquist = static_cast<float>(sr) / 2.0f;
897 }
898
900
901
903
904
905
911
912
919
920
923
924
926 static_cast<float>(sr),
935
936
938 samples, static_cast<float>(sr),
946
947
949 for (int i = 0; i < bands; ++i) {
956 } else {
958 }
959 }
960 }
#define FASTLED_STACK_ARRAY(TYPE, NAME, SIZE)
Stack-allocated array with automatic zero-initialization.
fl::vector< alpha16 > mHybridBassWindow
fl::vector< kiss_fft_scalar > mWorkBuf
void buildLinearBinLut(fl::vector< u8 > &lut, int fftN) FL_NO_EXCEPT
void buildLogBinLut(fl::vector< u8 > &lut, int fftN, float fs, int binStart, int binEnd) FL_NO_EXCEPT
fl::vector< u8 > mLinearBinLut
void initWindow() FL_NO_EXCEPT
fl::vector< alpha16 > mHybridMidWindow
fl::vector< kiss_fft_cpx > mHybridMidFftOut
fl::vector< float > mLogBinEdges
fl::vector< u8 > mLogBinLutMid
fl::vector< kiss_fft_cpx > mHybridSmallFftOut
fl::vector< float > mHybridNormUpper
fl::vector< u8 > mLogBinLutBass
fl::vector< u8 > mLogBinLut
fl::vector< kiss_fft_cpx > mFftOut
static void computeWindow(fl::vector< alpha16 > &win, int N, Window type) FL_NO_EXCEPT
kiss_fftr_cfg mHybridMidFft
void computeBinEdgesQ16() FL_NO_EXCEPT
fl::vector< float > mHybridNormBass
fl::vector< float > mHybridMergedNorm
void computeLogRebinNormFactors(fl::vector< float > &normFactors, const fl::vector< u8 > &lut, int fftN, float fs, int binStart, int binEnd) FL_NO_EXCEPT
kiss_fftr_cfg mHybridSmallFft
fl::vector< float > mHybridNormMid
kiss_fftr_cfg kiss_fftr_alloc(int nfft, int inverse_fft, void *mem, size_t *lenmem)
float logf(float value) FL_NO_EXCEPT
float expf(float value) FL_NO_EXCEPT