Changeset d53a3b5


Ignore:
Timestamp:
Sep 21, 2009, 6:15:05 PM (10 years ago)
Author:
Paul Brossier <piem@piem.org>
Branches:
feature/autosink, feature/constantq, feature/pitchshift, feature/pydocstrings, feature/timestretch, master, pitchshift, sampler, timestretch, yinfft+
Children:
55b7cb4
Parents:
adcf405
Message:

src/spectral/fft.c: fix horrible bug where norm[0] and norm[n/2+1] could be negative

File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/spectral/fft.c

    radcf405 rd53a3b5  
    170170  uint_t i, j = 0;
    171171  for (i = 0; i < spectrum->channels; i++) {
    172     spectrum->norm[i][0] = compspec->data[i][0];
     172    spectrum->norm[i][0] = ABS(compspec->data[i][0]);
    173173    for (j=1; j < spectrum->length - 1; j++) {
    174174      spectrum->norm[i][j] = SQRT(SQR(compspec->data[i][j])
    175175          + SQR(compspec->data[i][compspec->length - j]) );
    176176    }
    177     spectrum->norm[i][spectrum->length-1] = compspec->data[i][compspec->length/2];
     177    spectrum->norm[i][spectrum->length-1] =
     178      ABS(compspec->data[i][compspec->length/2]);
    178179  }
    179180}
Note: See TracChangeset for help on using the changeset viewer.