Use Hann window function instead of Hamming (issue 48)

This helps to clear up spectral bleeding.

Signed-off-by: Alexander Kojevnikov <alexander@kojevnikov.com>
This commit is contained in:
Daniel Hams 2011-04-24 19:54:25 +08:00 committed by Alexander Kojevnikov
parent 968c1644d2
commit bc5214b3e1

View File

@ -243,8 +243,11 @@ namespace Spek {
prev_head = head;
for (int i = 0; i < nfft; i++) {
float val = input[(input_size + head - nfft + i) % input_size];
// TODO: allow the user to chose the window function
// Hamming window.
val *= 0.53836f - 0.46164f * coss[i];
// val *= 0.53836f - 0.46164f * coss[i];
// Hann window.
val *= 0.5f * (1f - coss[i]);
fft.input[i] = val;
}
fft.execute ();