Mercurial > hg > nnls-chroma
comparison Chordino.cpp @ 159:f01e5707b804
Typo fix
author | Chris Cannam |
---|---|
date | Fri, 05 Dec 2014 10:46:04 +0000 |
parents | 5c1a25b3daf0 |
children | ed3e7d4bcdaf |
comparison
equal
deleted
inserted
replaced
158:55c2dacd0d34 | 159:f01e5707b804 |
---|---|
183 m_outputChords = index++; | 183 m_outputChords = index++; |
184 | 184 |
185 OutputDescriptor chordnotes; | 185 OutputDescriptor chordnotes; |
186 chordnotes.identifier = "chordnotes"; | 186 chordnotes.identifier = "chordnotes"; |
187 chordnotes.name = "Note Representation of Chord Estimate"; | 187 chordnotes.name = "Note Representation of Chord Estimate"; |
188 chordnotes.description = "A simple represenation of the estimated chord with bass note (if applicable) and chord notes."; | 188 chordnotes.description = "A simple representation of the estimated chord with bass note (if applicable) and chord notes."; |
189 chordnotes.unit = "MIDI units"; | 189 chordnotes.unit = "MIDI units"; |
190 chordnotes.hasFixedBinCount = true; | 190 chordnotes.hasFixedBinCount = true; |
191 chordnotes.binCount = 1; | 191 chordnotes.binCount = 1; |
192 chordnotes.hasKnownExtents = true; | 192 chordnotes.hasKnownExtents = true; |
193 chordnotes.minValue = 0; | 193 chordnotes.minValue = 0; |
532 trans.push_back(temp); | 532 trans.push_back(temp); |
533 } | 533 } |
534 vector<double> scale; | 534 vector<double> scale; |
535 vector<int> chordpath = ViterbiPath(init, trans, chordogram, delta, &scale); | 535 vector<int> chordpath = ViterbiPath(init, trans, chordogram, delta, &scale); |
536 | 536 |
537 | |
538 Feature chord_feature; // chord estimate | 537 Feature chord_feature; // chord estimate |
539 chord_feature.hasTimestamp = true; | 538 chord_feature.hasTimestamp = true; |
540 chord_feature.timestamp = timestamps[0]; | 539 chord_feature.timestamp = timestamps[0]; |
541 chord_feature.label = m_chordnames[chordpath[0]]; | 540 chord_feature.label = m_chordnames[chordpath[0]]; |
542 fsOut[m_outputChords].push_back(chord_feature); | 541 fsOut[m_outputChords].push_back(chord_feature); |
543 | 542 |
544 chordchange[0] = 0; | 543 chordchange[0] = 0; |
545 for (int iFrame = 1; iFrame < (int)chordpath.size(); ++iFrame) { | 544 for (int iFrame = 1; iFrame < (int)chordpath.size(); ++iFrame) { |
546 // cerr << chordpath[iFrame] << endl; | |
547 if (chordpath[iFrame] != oldchord ) { | 545 if (chordpath[iFrame] != oldchord ) { |
548 // chord | 546 // chord |
549 Feature chord_feature; // chord estimate | 547 Feature chord_feature; // chord estimate |
550 chord_feature.hasTimestamp = true; | 548 chord_feature.hasTimestamp = true; |
551 chord_feature.timestamp = timestamps[iFrame]; | 549 chord_feature.timestamp = timestamps[iFrame]; |
595 oldnotes[iNote].duration = oldnotes[iNote].duration + timestamps[timestamps.size()-1]; | 593 oldnotes[iNote].duration = oldnotes[iNote].duration + timestamps[timestamps.size()-1]; |
596 fsOut[m_outputChordnotes].push_back(oldnotes[iNote]); | 594 fsOut[m_outputChordnotes].push_back(oldnotes[iNote]); |
597 } | 595 } |
598 | 596 |
599 cerr << "done." << endl; | 597 cerr << "done." << endl; |
600 | 598 |
601 for (int iFrame = 0; iFrame < nFrame; iFrame++) { | 599 for (int iFrame = 0; iFrame < nFrame; iFrame++) { |
602 Feature chordchange_feature; | 600 Feature chordchange_feature; |
603 chordchange_feature.hasTimestamp = true; | 601 chordchange_feature.hasTimestamp = true; |
604 chordchange_feature.timestamp = timestamps[iFrame]; | 602 chordchange_feature.timestamp = timestamps[iFrame]; |
605 chordchange_feature.values.push_back(chordchange[iFrame]); | 603 chordchange_feature.values.push_back(chordchange[iFrame]); |
607 fsOut[m_outputHarmonicChange].push_back(chordchange_feature); | 605 fsOut[m_outputHarmonicChange].push_back(chordchange_feature); |
608 } | 606 } |
609 | 607 |
610 // for (int iFrame = 0; iFrame < nFrame; iFrame++) cerr << fsOut[m_outputHarmonicChange][iFrame].values[0] << endl; | 608 // for (int iFrame = 0; iFrame < nFrame; iFrame++) cerr << fsOut[m_outputHarmonicChange][iFrame].values[0] << endl; |
611 | 609 |
612 | |
613 return fsOut; | 610 return fsOut; |
614 } | 611 } |