Mercurial > hg > pyin
changeset 94:2687ba2cafae
some cleaning up
author | matthiasm |
---|---|
date | Wed, 07 Jan 2015 17:05:07 +0000 |
parents | b24668a40770 |
children | ca0ea8c9c712 |
files | MonoNoteHMM.cpp PYIN.cpp |
diffstat | 2 files changed, 4 insertions(+), 21 deletions(-) [+] |
line wrap: on
line diff
--- a/MonoNoteHMM.cpp Wed Jan 07 16:32:18 2015 +0000 +++ b/MonoNoteHMM.cpp Wed Jan 07 17:05:07 2015 +0000 @@ -127,7 +127,6 @@ pitchDistr[index] = boost::math::normal(mu, par.sigmaYinPitchAttack); pitchDistr[index+1] = boost::math::normal(mu, par.sigmaYinPitchStable); pitchDistr[index+2] = boost::math::normal(mu, 1.0); // dummy - pitchDistr[index+3] = boost::math::normal(mu, par.sigmaYinPitchInter); } boost::math::normal noteDistanceDistr(0, par.sigma2Note); @@ -155,24 +154,15 @@ to.push_back(index+2); // to silent transProb.push_back(par.pStable2Silent); - // from.push_back(index+1); - // to.push_back(index+3); // to inter-note - // transProb.push_back(1-par.pStableSelftrans-par.pStable2Silent); - // the "easy" transitions from silent state from.push_back(index+2); to.push_back(index+2); transProb.push_back(par.pSilentSelftrans); - // // the "easy" inter state transition - // from.push_back(index+3); - // to.push_back(index+3); - // transProb.push_back(par.pInterSelftrans); - // the more complicated transitions from the silent and inter state + // the more complicated transitions from the silent double probSumSilent = 0; - // double probSumInter = 0; - // vector<double> tempTransProbInter; + vector<double> tempTransProbSilent; for (size_t jPitch = 0; jPitch < (par.nS * par.nPPS); ++jPitch) { @@ -190,24 +180,17 @@ double tempWeightSilent = boost::math::pdf(noteDistanceDistr, semitoneDistance); - // double tempWeightInter = semitoneDistance == 0 ? - // 0 : tempWeightSilent; probSumSilent += tempWeightSilent; - // probSumInter += tempWeightInter; tempTransProbSilent.push_back(tempWeightSilent); - // tempTransProbInter.push_back(tempWeightInter); from.push_back(index+2); to.push_back(toIndex); - // from.push_back(index+3); - // to.push_back(toIndex); } } for (size_t i = 0; i < tempTransProbSilent.size(); ++i) { transProb.push_back((1-par.pSilentSelftrans) * tempTransProbSilent[i]/probSumSilent); - // transProb.push_back((1-par.pInterSelftrans) * tempTransProbInter[i]/probSumInter); } } }
--- a/PYIN.cpp Wed Jan 07 16:32:18 2015 +0000 +++ b/PYIN.cpp Wed Jan 07 17:05:07 2015 +0000 @@ -476,8 +476,8 @@ { isVoiced = mnOut[iFrame].noteState < 3 && smoothedPitch[iFrame].size() > 0 - && (iFrame == nFrame-1 - || ((m_level[iFrame+1]/m_level[iFrame]) < 1.25)); + && (iFrame >= nFrame-2 + || ((m_level[iFrame]/m_level[iFrame+2]) > 0.8)); // std::cerr << m_level[iFrame]/m_level[iFrame-1] << std::endl; if (isVoiced && iFrame != nFrame-1) {