Skip to content

Commit

Permalink
PitchYin: code cleanup, improve doc (#230)
Browse files Browse the repository at this point in the history
  • Loading branch information
dbogdanov committed Mar 12, 2015
1 parent d0f2ec7 commit 5350e16
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 22 deletions.
23 changes: 4 additions & 19 deletions src/algorithms/tonal/pitchyin.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -26,17 +26,17 @@ using namespace standard;


const char* PitchYin::name = "PitchYin";
const char* PitchYin::description = DOC("This algorithm estimates the fundamental frequency from a given spectrum. It is an implementation of Yin algorithm [1], for computations in the time domain.\n"
const char* PitchYin::description = DOC("This algorithm estimates the fundamental frequency from a given spectrum. It is an implementation of the Yin algorithm [1] for computations in the time domain.\n"
"\n"
"An exception is thrown if an empty signal is provided.\n"
"\n"
"Please note that if \"pitchConfidence\" is zero, \"pitch\" is undefined and should not be used for other algorithms.\n"
"Also note that a null \"pitch\" is never ouput by the algorithm and that \"pitchConfidence\" must always be checked out.\n"
"\n"
"References:\n"
//TODO
//" [1] P. M. Brossier, \"Automatic Annotation of Musical Audio for Interactive\n"
//" Applications,” QMUL, London, UK, 2007.\n\n"
" [1] De Cheveigné, A., & Kawahara, H. \"YIN, a fundamental frequency estimator\n"
" for speech and music. The Journal of the Acoustical Society of America,\n"
" 111(4), 1917-1930, 2002.\n\n"
" [2] Pitch detection algorithm - Wikipedia, the free encyclopedia\n"
" http://en.wikipedia.org/wiki/Pitch_detection_algorithm");

Expand Down Expand Up @@ -139,21 +139,6 @@ void PitchYin::compute() {
// peaks and process the values manually instead of running peak detection
// twice and detecting only two peaks.

/*
for (int tau=1; tau < _yin.size(); ++tau) {
if (_yin[ŧau] < _threshold) {
// Check if this is a local minima
if (tau < _yin.size()-1 && _yin[ŧau] < _yin[tau+1] || tau = _yin.size()-1) {
period = tau;
}
}
}
if(!period) {
period = argmin(_yin);
}
*/

// TODO: how to compute confidence?
// Aubio computes it as 1 - min(_yin), but this does not correspond to the peak
// dound by peakDetectLocal
Expand Down
4 changes: 1 addition & 3 deletions src/algorithms/tonal/pitchyin.h
Original file line number Diff line number Diff line change
Expand Up @@ -35,9 +35,7 @@ class PitchYin : public Algorithm {
Algorithm* _peakDetectLocal;
Algorithm* _peakDetectGlobal;


std::vector<Real> _df; // cumulative mean normalized difference function
std::vector<Real> _yin; // Yin function
std::vector<Real> _yin; // Yin function (cumulative mean normalized difference)
std::vector<Real> _positions; // Yin function peak positions
std::vector<Real> _amplitudes; // Yin function peak amplitudes

Expand Down

0 comments on commit 5350e16

Please sign in to comment.