diff options
author | Robin Gareus <robin@gareus.org> | 2019-09-03 04:52:01 +0200 |
---|---|---|
committer | Robin Gareus <robin@gareus.org> | 2019-09-03 04:52:01 +0200 |
commit | 58ee66e9245b432249e2fba4049c34d1a9127a43 (patch) | |
tree | f89028939badff02cf22a8ca18d0c02e829b535a /libs/vamp-pyin/MonoNoteHMM.cpp | |
parent | b340dc7282a3629929cd91223fe3505b2ad92c58 (diff) |
NO-OP: remove trailing whitespace
Diffstat (limited to 'libs/vamp-pyin/MonoNoteHMM.cpp')
-rw-r--r-- | libs/vamp-pyin/MonoNoteHMM.cpp | 35 |
1 files changed, 17 insertions, 18 deletions
diff --git a/libs/vamp-pyin/MonoNoteHMM.cpp b/libs/vamp-pyin/MonoNoteHMM.cpp index 9abd92af11..202467064e 100644 --- a/libs/vamp-pyin/MonoNoteHMM.cpp +++ b/libs/vamp-pyin/MonoNoteHMM.cpp @@ -3,7 +3,7 @@ /* pYIN - A fundamental frequency estimator for monophonic audio Centre for Digital Music, Queen Mary, University of London. - + This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the @@ -31,9 +31,9 @@ const vector<double> MonoNoteHMM::calculateObsProb(const vector<pair<double, double> > pitchProb) { // pitchProb is a list of pairs (pitches and their probabilities) - + size_t nCandidate = pitchProb.size(); - + // what is the probability of pitched double pIsPitched = 0; for (size_t iCandidate = 0; iCandidate < nCandidate; ++iCandidate) @@ -68,8 +68,8 @@ MonoNoteHMM::calculateObsProb(const vector<pair<double, double> > pitchProb) minDistCandidate = iCandidate; } } - tempProb = std::pow(minDistProb, par.yinTrust) * - boost::math::pdf(pitchDistr[i], + tempProb = std::pow(minDistProb, par.yinTrust) * + boost::math::pdf(pitchDistr[i], pitchProb[minDistCandidate].first); } else { tempProb = 1; @@ -78,12 +78,12 @@ MonoNoteHMM::calculateObsProb(const vector<pair<double, double> > pitchProb) out[i] = tempProb; } } - + for (size_t i = 0; i < par.n; ++i) { if (i % par.nSPP != 2) { - if (tempProbSum > 0) + if (tempProbSum > 0) { out[i] = out[i] / tempProbSum * pIsPitched; } @@ -106,7 +106,7 @@ MonoNoteHMM::build() // 3-5. second-lowest pitch // 3. attack state // ... - + // observation distributions for (size_t iState = 0; iState < par.n; ++iState) { @@ -116,7 +116,7 @@ MonoNoteHMM::build() // silent state starts tracking init.push_back(1.0/(par.nS * par.nPPS)); } else { - init.push_back(0.0); + init.push_back(0.0); } } @@ -128,7 +128,7 @@ MonoNoteHMM::build() pitchDistr[index+1] = boost::math::normal(mu, par.sigmaYinPitchStable); pitchDistr[index+2] = boost::math::normal(mu, 1.0); // dummy } - + boost::math::normal noteDistanceDistr(0, par.sigma2Note); for (size_t iPitch = 0; iPitch < (par.nS * par.nPPS); ++iPitch) @@ -149,7 +149,7 @@ MonoNoteHMM::build() from.push_back(index+1); to.push_back(index+1); // to itself transProb.push_back(par.pStableSelftrans); - + from.push_back(index+1); to.push_back(index+2); // to silent transProb.push_back(par.pStable2Silent); @@ -158,8 +158,7 @@ MonoNoteHMM::build() from.push_back(index+2); to.push_back(index+2); transProb.push_back(par.pSilentSelftrans); - - + // the more complicated transitions from the silent double probSumSilent = 0; @@ -168,17 +167,17 @@ MonoNoteHMM::build() { int fromPitch = iPitch; int toPitch = jPitch; - double semitoneDistance = + double semitoneDistance = std::abs(fromPitch - toPitch) * 1.0 / par.nPPS; - + // if (std::fmod(semitoneDistance, 1) == 0 && semitoneDistance > par.minSemitoneDistance) - if (semitoneDistance == 0 || - (semitoneDistance > par.minSemitoneDistance + if (semitoneDistance == 0 || + (semitoneDistance > par.minSemitoneDistance && semitoneDistance < par.maxJump)) { size_t toIndex = jPitch * par.nSPP; // note attack index - double tempWeightSilent = boost::math::pdf(noteDistanceDistr, + double tempWeightSilent = boost::math::pdf(noteDistanceDistr, semitoneDistance); probSumSilent += tempWeightSilent; |