Changeset 8979752 for src


Ignore:
Timestamp:
Oct 11, 2009, 12:38:43 PM (15 years ago)
Author:
Paul Brossier <piem@piem.org>
Branches:
feature/autosink, feature/cnn, feature/cnn_org, feature/constantq, feature/crepe, feature/crepe_org, feature/pitchshift, feature/pydocstrings, feature/timestretch, fix/ffmpeg5, master, pitchshift, sampler, timestretch, yinfft+
Children:
4f4299d
Parents:
2fde783
Message:

src/spectral/fft.c: 0 and N/2 + 1 phase must carry the sign of respective real components

File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/spectral/fft.c

    r2fde783 r8979752  
    184184  uint_t i, j;
    185185  for (i = 0; i < spectrum->channels; i++) {
    186     spectrum->phas[i][0] = 0.;
     186    if (compspec->data[i][0] < 0) {
     187      spectrum->phas[i][0] = PI;
     188    } else {
     189      spectrum->phas[i][0] = 0.;
     190    }
    187191    for (j=1; j < spectrum->length - 1; j++) {
    188192      spectrum->phas[i][j] = ATAN2(compspec->data[i][compspec->length-j],
    189193          compspec->data[i][j]);
    190194    }
    191     spectrum->phas[i][spectrum->length-1] = 0.;
     195    if (compspec->data[i][compspec->length/2] < 0) {
     196      spectrum->phas[i][spectrum->length - 1] = PI;
     197    } else {
     198      spectrum->phas[i][spectrum->length - 1] = 0.;
     199    }
    192200  }
    193201}
Note: See TracChangeset for help on using the changeset viewer.