summaryrefslogtreecommitdiff
path: root/src/fft.cpp
diff options
context:
space:
mode:
authorVasile Vilvoiu <vasi@vilvoiu.ro>2021-07-19 20:46:56 +0300
committerVasile Vilvoiu <vasi@vilvoiu.ro>2021-07-19 20:46:56 +0300
commit5a3eb9f10863abeea248adb2acf5df44a2b0a048 (patch)
tree26b6675ca93085801ef1f318ebd8efb5fcba261c /src/fft.cpp
parent78225142a8b3c0f95090b089eef32c244ed03551 (diff)
Move normalization from ValueMap to FFT class.
Diffstat (limited to 'src/fft.cpp')
-rw-r--r--src/fft.cpp7
1 files changed, 6 insertions, 1 deletions
diff --git a/src/fft.cpp b/src/fft.cpp
index 8f94986..2802346 100644
--- a/src/fft.cpp
+++ b/src/fft.cpp
@@ -104,6 +104,11 @@ FFT::Compute(const ComplexWindow& input)
(void *) this->out_,
lhl * sizeof(fftw_complex));
+ /* fftw does not normalize; divide by the window size */
+ for (auto& v : output) {
+ v /= (double)output.size();
+ }
+
return output;
}
@@ -231,4 +236,4 @@ FFT::Crop(const RealWindow& input, double rate, double fmin, double fmax)
/* return corresponding subvector */
return RealWindow(input.begin() + i_fmin, input.begin() + i_fmax);
-} \ No newline at end of file
+}