Mercurial > hg > qm-dsp
diff tests/TestChromagram.cpp @ 467:1db23b9a8da4
Fix mismatch between time- and frequency-domain versions of the
chromagram process method - the frequency-domain one expects fftshifted
input and the kernel is set up for that, but the time-domain one wasn't
doing it
author | Chris Cannam <cannam@all-day-breakfast.com> |
---|---|
date | Wed, 29 May 2019 15:56:30 +0100 |
parents | 50a97c8d52ed |
children | dd132354ea02 |
line wrap: on
line diff
--- a/tests/TestChromagram.cpp Wed May 29 14:08:43 2019 +0100 +++ b/tests/TestChromagram.cpp Wed May 29 15:56:30 2019 +0100 @@ -34,11 +34,9 @@ int length) { vector<double> buffer; - buffer.reserve(length); for (int i = 0; i < length; ++i) { buffer.push_back(sin((i * M_PI * 2.0 * frequency) / sampleRate)); } - return buffer; } @@ -50,7 +48,7 @@ BOOST_AUTO_TEST_CASE(sinusoid_12tET) { double concertA = 440.0; - double sampleRate = 44100; + double sampleRate = 44100.0; int bpo = 60; ChromaConfig config { @@ -85,7 +83,7 @@ vector<double> signal = generateSinusoid(frequency, sampleRate, blockSize); - + double *output = chroma.process(signal.data()); int peakBin = -1; @@ -107,6 +105,11 @@ if (peakBin != expectedPeakBin) { cout << "NOTE: peak bin " << peakBin << " does not match expected " << expectedPeakBin << endl; + cout << "bin values are: "; + for (int i = 0; i < bpo; ++i) { + cout << i << ": " << output[i] << " "; + } + cout << endl; } } }