Mercurial > hg > qm-dsp
comparison dsp/keydetection/GetKeyMode.cpp @ 248:fd68f25b9949
* remove some debug output
author | Chris Cannam <c.cannam@qmul.ac.uk> |
---|---|
date | Thu, 10 Jan 2008 15:14:30 +0000 |
parents | a98dd8ec96f8 |
children | ad645e404d0c |
comparison
equal
deleted
inserted
replaced
247:a98a8fe967c0 | 248:fd68f25b9949 |
---|---|
66 m_ChromaConfig.max = m_ChromaConfig.min * 2; | 66 m_ChromaConfig.max = m_ChromaConfig.min * 2; |
67 m_ChromaConfig.max = m_ChromaConfig.max * 2; | 67 m_ChromaConfig.max = m_ChromaConfig.max * 2; |
68 m_ChromaConfig.max = m_ChromaConfig.max * 2; | 68 m_ChromaConfig.max = m_ChromaConfig.max * 2; |
69 m_ChromaConfig.max = m_ChromaConfig.max * 2; | 69 m_ChromaConfig.max = m_ChromaConfig.max * 2; |
70 */ | 70 */ |
71 std::cerr << "Chromagram range: " << m_ChromaConfig.min << " -> " << m_ChromaConfig.max << std::endl; | 71 // std::cerr << "Chromagram range: " << m_ChromaConfig.min << " -> " << m_ChromaConfig.max << std::endl; |
72 | 72 |
73 m_ChromaConfig.BPO = 36; | 73 m_ChromaConfig.BPO = 36; |
74 m_ChromaConfig.CQThresh = 0.0054; | 74 m_ChromaConfig.CQThresh = 0.0054; |
75 | 75 |
76 //Chromagram inst. | 76 //Chromagram inst. |
174 | 174 |
175 // Move bins such that the centre of the base note is in the middle of its three bins : | 175 // Move bins such that the centre of the base note is in the middle of its three bins : |
176 // Added 21.11.07 by Chris Sutton based on debugging with Katy Noland + comparison with Matlab equivalent. | 176 // Added 21.11.07 by Chris Sutton based on debugging with Katy Noland + comparison with Matlab equivalent. |
177 MathUtilities::circShift( m_ChrPointer, m_BPO, 1); | 177 MathUtilities::circShift( m_ChrPointer, m_BPO, 1); |
178 | 178 |
179 /* | |
179 std::cout << "raw chroma: "; | 180 std::cout << "raw chroma: "; |
180 for (int ii = 0; ii < m_BPO; ++ii) { | 181 for (int ii = 0; ii < m_BPO; ++ii) { |
181 std::cout << m_ChrPointer[ii] << " "; | 182 std::cout << m_ChrPointer[ii] << " "; |
182 } | 183 } |
183 std::cout << std::endl; | 184 std::cout << std::endl; |
184 | 185 */ |
185 // populate hpcp values; | 186 // populate hpcp values; |
186 int cbidx; | 187 int cbidx; |
187 for( j = 0; j < m_BPO; j++ ) | 188 for( j = 0; j < m_BPO; j++ ) |
188 { | 189 { |
189 cbidx = (m_bufferindex * m_BPO) + j; | 190 cbidx = (m_bufferindex * m_BPO) + j; |
225 m_Keys[k] = m_MajCorr[k]; | 226 m_Keys[k] = m_MajCorr[k]; |
226 m_Keys[k+m_BPO] = m_MinCorr[k]; | 227 m_Keys[k+m_BPO] = m_MinCorr[k]; |
227 } | 228 } |
228 | 229 |
229 | 230 |
231 /* | |
230 std::cout << "raw keys: "; | 232 std::cout << "raw keys: "; |
231 for (int ii = 0; ii < 2*m_BPO; ++ii) { | 233 for (int ii = 0; ii < 2*m_BPO; ++ii) { |
232 std::cout << m_Keys[ii] << " "; | 234 std::cout << m_Keys[ii] << " "; |
233 } | 235 } |
234 std::cout << std::endl; | 236 std::cout << std::endl; |
235 | 237 */ |
236 double dummy; | 238 double dummy; |
237 // '1 +' because we number keys 1-24, not 0-23. | 239 // '1 +' because we number keys 1-24, not 0-23. |
238 key = 1 + (int)ceil( (double)MathUtilities::getMax( m_Keys, 2* m_BPO, &dummy )/3 ); | 240 key = 1 + (int)ceil( (double)MathUtilities::getMax( m_Keys, 2* m_BPO, &dummy )/3 ); |
239 | 241 |
240 std::cout << "key pre-sorting: " << key << std::endl; | 242 // std::cout << "key pre-sorting: " << key << std::endl; |
241 | 243 |
242 | 244 |
243 //Median filtering | 245 //Median filtering |
244 | 246 |
245 // track Median buffer initial filling | 247 // track Median buffer initial filling |
265 } | 267 } |
266 | 268 |
267 | 269 |
268 //quicksort | 270 //quicksort |
269 qsort(m_SortedBuffer, m_MedianBufferFilling, sizeof(unsigned int), MathUtilities::compareInt); | 271 qsort(m_SortedBuffer, m_MedianBufferFilling, sizeof(unsigned int), MathUtilities::compareInt); |
270 | 272 /* |
271 std::cout << "sorted: "; | 273 std::cout << "sorted: "; |
272 for (int ii = 0; ii < m_MedianBufferFilling; ++ii) { | 274 for (int ii = 0; ii < m_MedianBufferFilling; ++ii) { |
273 std::cout << m_SortedBuffer[ii] << " "; | 275 std::cout << m_SortedBuffer[ii] << " "; |
274 } | 276 } |
275 std::cout << std::endl; | 277 std::cout << std::endl; |
276 | 278 */ |
277 int sortlength = m_MedianBufferFilling; | 279 int sortlength = m_MedianBufferFilling; |
278 int midpoint = (int)ceil((double)sortlength/2); | 280 int midpoint = (int)ceil((double)sortlength/2); |
279 | 281 |
280 if( midpoint <= 0 ) | 282 if( midpoint <= 0 ) |
281 midpoint = 1; | 283 midpoint = 1; |