diff options
author | Daniel Schürmann <daschuer@mixxx.org> | 2019-05-14 00:24:54 +0200 |
---|---|---|
committer | Daniel Schürmann <daschuer@mixxx.org> | 2019-05-14 00:24:54 +0200 |
commit | ffa1bcaf5db5edea01dd8dd3da681cfdae890d14 (patch) | |
tree | e9bc39ed267661a5a9537ecfd80e88b2f36a3cb0 /lib | |
parent | b9c6bde3bd54727abd459dc110a6123ba4efd0e6 (diff) |
Use double precision to generate the reference waveform hanning window
Diffstat (limited to 'lib')
-rw-r--r-- | lib/qm-dsp/dsp/chromagram/ConstantQ.cpp | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/lib/qm-dsp/dsp/chromagram/ConstantQ.cpp b/lib/qm-dsp/dsp/chromagram/ConstantQ.cpp index bbd587abcf..414833f2b8 100644 --- a/lib/qm-dsp/dsp/chromagram/ConstantQ.cpp +++ b/lib/qm-dsp/dsp/chromagram/ConstantQ.cpp @@ -125,15 +125,18 @@ void ConstantQ::sparsekernel() hammingWindowIm[u] = 0; } + const double samplesPerCycle = + m_FS / (m_FMin * pow(2, (double)k / (double)m_BPO)); + // Computing a hamming window const unsigned hammingLength = (int) ceil( - m_dQ * m_FS / (m_FMin * pow(2, (double)k / (double)m_BPO))); + m_dQ * samplesPerCycle); unsigned origin = m_FFTLength/2 - hammingLength/2; for (unsigned i=0; i<hammingLength; i++) { - const double angle = 2*PI*m_dQ*i/hammingLength; + const double angle = 2*PI*i/samplesPerCycle; const double real = cos(angle); const double imag = sin(angle); const double absol = hamming(hammingLength, i)/hammingLength; |