Explorar o código

Remove genomsnitt in amplitude for grouped freqs, instead sum of amplitude for those freqs. Looks slightly better but freq bias and power vs color needs new balancing.
Might want to change to the highest amplitude instead of sum.

Emil %!s(int64=3) %!d(string=hai) anos
pai
achega
d829e6d95d
Modificáronse 1 ficheiros con 2 adicións e 2 borrados
  1. 2 2
      adc_fft.c

+ 2 - 2
adc_fft.c

@@ -137,8 +137,8 @@ int main() {
                 totalPower += power[j];
             }
             //printf("lowInd = %d, highInd = %d, lowFreq = %f, highFreq = %f, freq[lowInd] = %f, freq[highInd] = %f\n", lowInd, highInd, lowFreq, highFreq, freqs[lowInd], freqs[highInd]);
-            float div_power = totalPower / (highInd + 1 - lowInd);
-            powerInLog[i] = 20 * log(fmax(div_power/100000, 1));//div_power/1000.0; //20 * log(fmax(div_power - 1000000, 1));
+            float div_power = totalPower; //  / (highInd + 1 - lowInd); // Might want to add this back, makes each section medelvärde instead of sum of all freqs.
+            powerInLog[i] = 20 * log(fmax(div_power/100000, 1));
         }
         //for (int i = 0; i < NUM_PIXELS - 1; i++) {
         //    printf("Power for freq %f to %f = %f (%f)\n", freqsInLog[i], freqsInLog[i + 1], powerInLog[i], power[i]);