this repo has no description
0
fork

Configure Feed

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

GPT5-high pass 2

alice eae7c19e 10b8b2b7

+5 -21
+5 -21
src/ext/vqt_kernel.c
··· 11 11 #include "kiss_fftr.h" 12 12 13 13 // Generate logarithmically spaced center frequencies for musical notes 14 - // Keeps equal-tempered semitone spacing exact (2^(1/12)) without scaling the ladder. 15 - // If the last bin slightly exceeds maxFreq due to floating-point error, adjust the 16 - // base frequency minimally so that the last bin matches maxFreq exactly. 14 + // Keeps equal-tempered semitone spacing exact (2^(1/12)) without any scaling. 15 + // Uses minFreq as the musical base and ignores maxFreq for placement. 17 16 void VQT_GenerateCenterFrequencies(float* frequencies, int numBins, float minFreq, float maxFreq) 18 17 { 19 - const double step = pow(2.0, 1.0 / 12.0); // semitone ratio 20 - const double stepsToTop = (double)(numBins - 1) / 12.0; // octaves to the top bin 21 - 22 - // Compute the ideal top frequency using high precision 23 - double base = (double)minFreq; 24 - double idealTop = base * pow(2.0, stepsToTop); 25 - 26 - // Allow a tiny tolerance for FP error before correcting the base 27 - const double eps = 1e-7; // relative tolerance 28 - if (idealTop > (double)maxFreq * (1.0 + eps)) 29 - { 30 - // Adjust base so that the top bin lands exactly at maxFreq 31 - base = (double)maxFreq / pow(2.0, stepsToTop); 32 - } 33 - 34 - // Fill frequencies using exact semitone spacing from the (possibly adjusted) base 18 + (void)maxFreq; // base is authoritative; maxFreq is not used to scale bins 19 + const double base = (double)minFreq; 35 20 for (int i = 0; i < numBins; i++) 36 21 { 37 - double f = base * pow(2.0, (double)i / 12.0); 38 - frequencies[i] = (float)f; 22 + frequencies[i] = (float)(base * pow(2.0, (double)i / 12.0)); 39 23 } 40 24 } 41 25