836 {
837 float logRatio =
logf(fmax / fmin);
838
839
841 for (int i = 0; i < bands; i++) {
842 centerFreqs[i] =
843 fmin *
expf(logRatio *
static_cast<float>(i) /
844 static_cast<float>(bands - 1));
845 }
846
847
848
849
850 float bassMidFreq = fmin * 4.0f;
851 float midUpperFreq = fmin * 8.0f;
852
853
854 if (midUpperFreq >= fmax) midUpperFreq = fmax * 0.5f;
855 if (bassMidFreq >= midUpperFreq) bassMidFreq = midUpperFreq * 0.5f;
856
857
859 for (int i = 0; i < bands; i++) {
860 if (centerFreqs[i] < bassMidFreq)
862 }
865 if (centerFreqs[i] < midUpperFreq)
867 }
868
869
875
876
878 if (bands <= 1) {
881 } else {
882 float denom = 2.0f * static_cast<float>(bands - 1);
884 for (int i = 1; i < bands; i++) {
886 fmin *
expf(logRatio *
887 (2.0f * static_cast<float>(i) - 1.0f) / denom);
888 }
890 }
891
892
893 float nyquist = static_cast<float>(sr) / 2.0f;
896 }
897
899
900
902
903
904
910
911
918
919
922
923
925 static_cast<float>(sr),
934
935
937 samples, static_cast<float>(sr),
945
946
948 for (int i = 0; i < bands; ++i) {
955 } else {
957 }
958 }
959 }
#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