comparison Chordino.cpp @ 163:59b26f52550d

Make some more debug output dependent on debug_on
author Chris Cannam
date Fri, 04 Sep 2015 12:22:09 +0100
parents ed3e7d4bcdaf
children 3c731acad404
comparison
equal deleted inserted replaced
162:c585c95f2d86 163:59b26f52550d
293 293
294 /** Tune Log-Frequency Spectrogram 294 /** Tune Log-Frequency Spectrogram
295 calculate a tuned log-frequency spectrogram (currentTunedSpec): use the tuning estimated above (kinda f0) to 295 calculate a tuned log-frequency spectrogram (currentTunedSpec): use the tuning estimated above (kinda f0) to
296 perform linear interpolation on the existing log-frequency spectrogram (kinda currentLogSpectrum). 296 perform linear interpolation on the existing log-frequency spectrogram (kinda currentLogSpectrum).
297 **/ 297 **/
298 cerr << endl << "[Chordino Plugin] Tuning Log-Frequency Spectrogram ... "; 298 if (debug_on) cerr << endl << "[Chordino Plugin] Tuning Log-Frequency Spectrogram ... ";
299 299
300 int count = 0; 300 int count = 0;
301 301
302 FeatureList tunedSpec; 302 FeatureList tunedSpec;
303 int nFrame = m_logSpectrum.size(); 303 int nFrame = m_logSpectrum.size();
344 } 344 }
345 } 345 }
346 tunedSpec.push_back(currentTunedSpec); 346 tunedSpec.push_back(currentTunedSpec);
347 count++; 347 count++;
348 } 348 }
349 cerr << "done." << endl; 349 if (debug_on) cerr << "done." << endl;
350 350
351 /** Semitone spectrum and chromagrams 351 /** Semitone spectrum and chromagrams
352 Semitone-spaced log-frequency spectrum derived from the tuned log-freq spectrum above. the spectrum 352 Semitone-spaced log-frequency spectrum derived from the tuned log-freq spectrum above. the spectrum
353 is inferred using a non-negative least squares algorithm. 353 is inferred using a non-negative least squares algorithm.
354 Three different kinds of chromagram are calculated, "treble", "bass", and "both" (which means 354 Three different kinds of chromagram are calculated, "treble", "bass", and "both" (which means
355 bass and treble stacked onto each other). 355 bass and treble stacked onto each other).
356 **/ 356 **/
357 if (m_useNNLS == 0) { 357 if (m_useNNLS == 0) {
358 cerr << "[Chordino Plugin] Mapping to semitone spectrum and chroma ... "; 358 if (debug_on) cerr << "[Chordino Plugin] Mapping to semitone spectrum and chroma ... ";
359 } else { 359 } else {
360 cerr << "[Chordino Plugin] Performing NNLS and mapping to chroma ... "; 360 if (debug_on) cerr << "[Chordino Plugin] Performing NNLS and mapping to chroma ... ";
361 } 361 }
362 362
363 363
364 vector<vector<double> > chordogram; 364 vector<vector<double> > chordogram;
365 vector<vector<int> > scoreChordogram; 365 vector<vector<int> > scoreChordogram;
509 } 509 }
510 chordogram.push_back(currentChordSalience); 510 chordogram.push_back(currentChordSalience);
511 511
512 count++; 512 count++;
513 } 513 }
514 cerr << "done." << endl; 514 if (debug_on) cerr << "done." << endl;
515 515
516 vector<Feature> oldnotes; 516 vector<Feature> oldnotes;
517 517
518 cerr << "[Chordino Plugin] HMM Chord Estimation ... "; 518 if (debug_on) cerr << "[Chordino Plugin] HMM Chord Estimation ... ";
519 int oldchord = nChord-1; 519 int oldchord = nChord-1;
520 double selftransprob = 0.99; 520 double selftransprob = 0.99;
521 521
522 // vector<double> init = vector<double>(nChord,1.0/nChord); 522 // vector<double> init = vector<double>(nChord,1.0/nChord);
523 vector<double> init = vector<double>(nChord,0); init[nChord-1] = 1; 523 vector<double> init = vector<double>(nChord,0); init[nChord-1] = 1;
592 for (int iNote = 0; iNote < (int)oldnotes.size(); ++iNote) { // finish duration of old chord 592 for (int iNote = 0; iNote < (int)oldnotes.size(); ++iNote) { // finish duration of old chord
593 oldnotes[iNote].duration = oldnotes[iNote].duration + timestamps[timestamps.size()-1]; 593 oldnotes[iNote].duration = oldnotes[iNote].duration + timestamps[timestamps.size()-1];
594 fsOut[m_outputChordnotes].push_back(oldnotes[iNote]); 594 fsOut[m_outputChordnotes].push_back(oldnotes[iNote]);
595 } 595 }
596 596
597 cerr << "done." << endl; 597 if (debug_on) cerr << "done." << endl;
598 598
599 for (int iFrame = 0; iFrame < nFrame; iFrame++) { 599 for (int iFrame = 0; iFrame < nFrame; iFrame++) {
600 Feature chordchange_feature; 600 Feature chordchange_feature;
601 chordchange_feature.hasTimestamp = true; 601 chordchange_feature.hasTimestamp = true;
602 chordchange_feature.timestamp = timestamps[iFrame]; 602 chordchange_feature.timestamp = timestamps[iFrame];