Mercurial > hg > pyin
changeset 50:85eb802a8091 tony
some tweaks to pyin:
* softly reduced probablilyt for low amplitude sounds
* allow smoothing to have quicker pitch shifts (otherwise frames with quick changes will be missed)
author | matthiasm |
---|---|
date | Fri, 28 Feb 2014 19:40:12 +0000 |
parents | 4db418fafb6d |
children | 39cd0e1bac0b 619c01e3467e b39d6745c596 |
files | MonoPitchHMM.cpp PYinVamp.cpp |
diffstat | 2 files changed, 5 insertions(+), 4 deletions(-) [+] |
line wrap: on
line diff
--- a/MonoPitchHMM.cpp Fri Feb 28 17:51:29 2014 +0000 +++ b/MonoPitchHMM.cpp Fri Feb 28 19:40:12 2014 +0000 @@ -30,7 +30,7 @@ m_yinTrust(.5), m_freqs(0) { - m_transitionWidth = 5*(m_nBPS/2) + 1; + m_transitionWidth = 9*(m_nBPS/2) + 1; m_nPitch = 48 * m_nBPS; m_freqs = vector<double>(2*m_nPitch); for (size_t iPitch = 0; iPitch < m_nPitch; ++iPitch)
--- a/PYinVamp.cpp Fri Feb 28 17:51:29 2014 +0000 +++ b/PYinVamp.cpp Fri Feb 28 19:40:12 2014 +0000 @@ -366,7 +366,8 @@ } rms /= m_blockSize; rms = sqrt(rms); - bool isLowVolume = (rms < 0.01); + float lowAmp = 0.01; + bool isLowAmplitude = (rms < lowAmp); Yin::YinOutput yo = m_yin.processProbabilisticYin(dInputBuffers); delete [] dInputBuffers; @@ -377,12 +378,12 @@ for (size_t iCandidate = 0; iCandidate < yo.freqProb.size(); ++iCandidate) { double tempPitch = 12 * std::log(yo.freqProb[iCandidate].first/440)/std::log(2.) + 69; - if (!isLowVolume) + if (!isLowAmplitude) tempPitchProb.push_back(pair<double, double> (tempPitch, yo.freqProb[iCandidate].second)); else tempPitchProb.push_back(pair<double, double> - (tempPitch, yo.freqProb[iCandidate].second*.01)); + (tempPitch, yo.freqProb[iCandidate].second*((rms+lowAmp)/(2*lowAmp)))); } m_pitchProb.push_back(tempPitchProb); m_timestamp.push_back(timestamp);