Bläddra i källkod

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 3 år sedan
förälder
incheckning
d829e6d95d
1 ändrade filer med 2 tillägg och 2 borttagningar
  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]);