comparison tests/TestChromagram.cpp @ 453:1b89d1916cd5

Inconsequential tweaks
author Chris Cannam <cannam@all-day-breakfast.com>
date Fri, 24 May 2019 16:15:52 +0100
parents 3f913390bcf2
children d8ad5893db6f
comparison
equal deleted inserted replaced
451:3f913390bcf2 453:1b89d1916cd5
34 int length) 34 int length)
35 { 35 {
36 vector<double> buffer; 36 vector<double> buffer;
37 buffer.reserve(length); 37 buffer.reserve(length);
38 for (int i = 0; i < length; ++i) { 38 for (int i = 0; i < length; ++i) {
39 buffer.push_back(sin(i * M_PI * 2.0 * frequency / sampleRate)); 39 buffer.push_back(sin((i * M_PI * 2.0 * frequency) / sampleRate));
40 } 40 }
41
41 return buffer; 42 return buffer;
42 } 43 }
43 44
44 double frequencyForPitch(int midiPitch, double concertA) 45 double frequencyForPitch(int midiPitch, double concertA)
45 { 46 {
61 MathUtilities::NormaliseNone 62 MathUtilities::NormaliseNone
62 }; 63 };
63 64
64 Chromagram chroma(config); 65 Chromagram chroma(config);
65 66
66 for (int midiPitch = 48; midiPitch < 96; ++midiPitch) { 67 for (int midiPitch = 36; midiPitch < 108; ++midiPitch) {
67 68
68 cout << endl; 69 cout << endl;
69 70
70 int blockSize = chroma.getFrameSize(); 71 int blockSize = chroma.getFrameSize();
71 int hopSize = chroma.getHopSize(); 72 int hopSize = chroma.getHopSize();
82 << expectedPeakBin << endl; 83 << expectedPeakBin << endl;
83 84
84 vector<double> signal = generateSinusoid(frequency, 85 vector<double> signal = generateSinusoid(frequency,
85 sampleRate, 86 sampleRate,
86 blockSize); 87 blockSize);
87 88
88 double *output = chroma.process(signal.data()); 89 double *output = chroma.process(signal.data());
89 90
90 int peakBin = -1; 91 int peakBin = -1;
91 double peakValue = 0.0; 92 double peakValue = 0.0;
92 93