소스 검색

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 년 전
부모
커밋
d829e6d95d
1개의 변경된 파일2개의 추가작업 그리고 2개의 파일을 삭제
  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]);