comparison src/FeatureExtractor.cpp @ 188:487261a22b18 re-minimise

distance_t * diagonalWeight might not fit in distance_t; use pathcost_t for it. Also remove C-style casts.
author Chris Cannam
date Thu, 26 Feb 2015 12:19:17 +0000
parents 6c12db195986
children 2fed1f101172
comparison
equal deleted inserted replaced
187:ba0d2104abec 188:487261a22b18
87 // 440Hz -- and then use it to scale the individual 87 // 440Hz -- and then use it to scale the individual
88 // frequency-domain audio frames before applying the map to them. 88 // frequency-domain audio frames before applying the map to them.
89 89
90 double refFreq = 440.; // See above -- *not* the parameter! 90 double refFreq = 440.; // See above -- *not* the parameter!
91 double binWidth = double(m_params.sampleRate) / m_params.fftSize; 91 double binWidth = double(m_params.sampleRate) / m_params.fftSize;
92 int crossoverBin = (int)(2 / (pow(2, 1/12.0) - 1)); 92 int crossoverBin = int(2 / (pow(2, 1/12.0) - 1));
93 int crossoverMidi = int(log(crossoverBin * binWidth / refFreq)/ 93 int crossoverMidi = int(log(crossoverBin * binWidth / refFreq)/
94 log(2.0) * 12 + 69 + 0.5); 94 log(2.0) * 12 + 69 + 0.5);
95 95
96 int i = 0; 96 int i = 0;
97 while (i <= crossoverBin) { 97 while (i <= crossoverBin) {
131 void 131 void
132 FeatureExtractor::makeChromaFrequencyMap() 132 FeatureExtractor::makeChromaFrequencyMap()
133 { 133 {
134 double refFreq = m_params.referenceFrequency; 134 double refFreq = m_params.referenceFrequency;
135 double binWidth = double(m_params.sampleRate) / m_params.fftSize; 135 double binWidth = double(m_params.sampleRate) / m_params.fftSize;
136 int crossoverBin = (int)(1 / (pow(2, 1/12.0) - 1)); 136 int crossoverBin = int(1 / (pow(2, 1/12.0) - 1));
137 int i = 0; 137 int i = 0;
138 while (i <= crossoverBin) { 138 while (i <= crossoverBin) {
139 double freq = i * binWidth; 139 double freq = i * binWidth;
140 if (freq < m_params.minFrequency || freq > m_params.maxFrequency) { 140 if (freq < m_params.minFrequency || freq > m_params.maxFrequency) {
141 m_freqMap[i++] = -1; 141 m_freqMap[i++] = -1;