comparison NNLSChroma.cpp @ 42:d01f94d58ef0 matthiasm-plugin

* added new parameter that toggles NNLS
author matthiasm
date Sun, 24 Oct 2010 20:43:11 +0900
parents d6bb9b43ac1c
children 131801714118
comparison
equal deleted inserted replaced
41:d6bb9b43ac1c 42:d01f94d58ef0
293 Semitone-spaced log-frequency spectrum derived from the tuned log-freq spectrum above. the spectrum 293 Semitone-spaced log-frequency spectrum derived from the tuned log-freq spectrum above. the spectrum
294 is inferred using a non-negative least squares algorithm. 294 is inferred using a non-negative least squares algorithm.
295 Three different kinds of chromagram are calculated, "treble", "bass", and "both" (which means 295 Three different kinds of chromagram are calculated, "treble", "bass", and "both" (which means
296 bass and treble stacked onto each other). 296 bass and treble stacked onto each other).
297 **/ 297 **/
298 if (m_dictID == 1) { 298 if (m_useNNLS == 0) {
299 cerr << "[NNLS Chroma Plugin] Mapping to semitone spectrum and chroma ... "; 299 cerr << "[NNLS Chroma Plugin] Mapping to semitone spectrum and chroma ... ";
300 } else { 300 } else {
301 cerr << "[NNLS Chroma Plugin] Performing NNLS and mapping to chroma ... "; 301 cerr << "[NNLS Chroma Plugin] Performing NNLS and mapping to chroma ... ";
302 } 302 }
303 303
344 vector<float> basschroma = vector<float>(12, 0); 344 vector<float> basschroma = vector<float>(12, 0);
345 float currval; 345 float currval;
346 unsigned iSemitone = 0; 346 unsigned iSemitone = 0;
347 347
348 if (some_b_greater_zero) { 348 if (some_b_greater_zero) {
349 if (m_dictID == 1) { 349 if (m_useNNLS == 0) {
350 for (unsigned iNote = 2; iNote < nNote - 2; iNote += 3) { 350 for (unsigned iNote = 2; iNote < nNote - 2; iNote += 3) {
351 currval = 0; 351 currval = 0;
352 currval += b[iNote + 1 + -1] * 0.5; 352 currval += b[iNote + 1 + -1] * 0.5;
353 currval += b[iNote + 1 + 0] * 1.0; 353 currval += b[iNote + 1 + 0] * 1.0;
354 currval += b[iNote + 1 + 1] * 0.5; 354 currval += b[iNote + 1 + 1] * 0.5;