# HG changeset patch # User matthiasm # Date 1394124507 0 # Node ID b13d82111c8f36e68dc76d346fc352e65d3ef1a2 # Parent b39d6745c59626a90d40140812eb52e03dbc0e9c# Parent 27682ab6070c1ed50e19d9ec5c6d79388fb767cd merge diff -r 27682ab6070c -r b13d82111c8f MonoNoteParameters.cpp --- a/MonoNoteParameters.cpp Thu Mar 06 16:30:30 2014 +0000 +++ b/MonoNoteParameters.cpp Thu Mar 06 16:48:27 2014 +0000 @@ -14,9 +14,9 @@ #include "MonoNoteParameters.h" MonoNoteParameters::MonoNoteParameters() : - minPitch(36), + minPitch(39), nPPS(3), - nS(43), + nS(64), nSPP(4), // states per pitch n(0), initPi(0), diff -r 27682ab6070c -r b13d82111c8f MonoPitchHMM.cpp --- a/MonoPitchHMM.cpp Thu Mar 06 16:30:30 2014 +0000 +++ b/MonoPitchHMM.cpp Thu Mar 06 16:48:27 2014 +0000 @@ -22,7 +22,8 @@ using std::pair; MonoPitchHMM::MonoPitchHMM() : -m_minFreq(55), +m_minFreq(77.782), // e flat 2 +// m_minFreq(110), m_nBPS(5), m_nPitch(0), m_transitionWidth(0), @@ -31,7 +32,7 @@ m_freqs(0) { m_transitionWidth = 9*(m_nBPS/2) + 1; - m_nPitch = 48 * m_nBPS; + m_nPitch = 64 * m_nBPS; m_freqs = vector(2*m_nPitch); for (size_t iPitch = 0; iPitch < m_nPitch; ++iPitch) { @@ -68,6 +69,8 @@ } double probReallyPitched = m_yinTrust * probYinPitched; + // std::cerr << probReallyPitched << " " << probYinPitched << std::endl; + // damn, I forget what this is all about... for (size_t iPitch = 0; iPitch < m_nPitch; ++iPitch) { if (probYinPitched > 0) out[iPitch] *= (probReallyPitched/probYinPitched) ; diff -r 27682ab6070c -r b13d82111c8f PYinVamp.cpp --- a/PYinVamp.cpp Thu Mar 06 16:30:30 2014 +0000 +++ b/PYinVamp.cpp Thu Mar 06 16:48:27 2014 +0000 @@ -35,7 +35,7 @@ m_stepSize(256), m_blockSize(2048), m_fmin(40), - m_fmax(700), + m_fmax(1600), m_yin(2048, inputSampleRate, 0.0), m_oF0Candidates(0), m_oF0Probs(0), @@ -366,7 +366,7 @@ } rms /= m_blockSize; rms = sqrt(rms); - float lowAmp = 0.01; + float lowAmp = 0.05; bool isLowAmplitude = (rms < lowAmp); Yin::YinOutput yo = m_yin.processProbabilisticYin(dInputBuffers); @@ -383,7 +383,7 @@ (tempPitch, yo.freqProb[iCandidate].second)); else tempPitchProb.push_back(pair - (tempPitch, yo.freqProb[iCandidate].second*((rms+lowAmp)/(2*lowAmp)))); + (tempPitch, yo.freqProb[iCandidate].second*((rms+0.01*lowAmp)/(1.01*lowAmp)))); } m_pitchProb.push_back(tempPitchProb); m_timestamp.push_back(timestamp); @@ -455,6 +455,7 @@ } // MONO-NOTE STUFF + std::cerr << "Mono Note Stuff" << std::endl; MonoNote mn; std::vector > > smoothedPitch; for (size_t iFrame = 0; iFrame < mpOut.size(); ++iFrame) { diff -r 27682ab6070c -r b13d82111c8f YinUtil.cpp --- a/YinUtil.cpp Thu Mar 06 16:30:30 2014 +0000 +++ b/YinUtil.cpp Thu Mar 06 16:48:27 2014 +0000 @@ -31,11 +31,6 @@ size_t frameSize = 2 * yinBufferSize; - for (size_t j = 0; j < yinBufferSize; ++j) - { - yinBuffer[j] = 0.; - } - double *audioTransformedReal = new double[frameSize]; double *audioTransformedImag = new double[frameSize]; double *nullImag = new double[frameSize]; @@ -48,7 +43,8 @@ for (size_t j = 0; j < yinBufferSize; ++j) { - powerTerms[j] = 0.; + yinBuffer[j] = 0.; // set to zero + powerTerms[j] = 0.; // set to zero } for (size_t j = 0; j < frameSize; ++j) @@ -82,7 +78,6 @@ // 2. half of the data, disguised as a convolution kernel for (size_t j = 0; j < yinBufferSize; ++j) { kernel[j] = in[yinBufferSize-1-j]; - kernel[j+yinBufferSize] = 0; } Vamp::FFT::forward(frameSize, kernel, nullImag, kernelTransformedReal, kernelTransformedImag); @@ -289,6 +284,11 @@ } } + if (peakProb[minInd] > 1) { + std::cerr << "WARNING: yin has prob > 1 ??? I'm returning all zeros instead." << std::endl; + return(std::vector(yinBufferSize)); + } + double nonPeakProb = 1; if (sumProb > 0) { for (size_t i = minTau; i < maxTau; ++i) @@ -297,7 +297,6 @@ nonPeakProb -= peakProb[i]; } } - // std::cerr << nonPeakProb << std::endl; if (minInd > 0) { // std::cerr << "min set " << minVal << " " << minInd << " " << nonPeakProb << std::endl; diff -r 27682ab6070c -r b13d82111c8f YinVamp.cpp --- a/YinVamp.cpp Thu Mar 06 16:30:30 2014 +0000 +++ b/YinVamp.cpp Thu Mar 06 16:48:27 2014 +0000 @@ -34,7 +34,7 @@ m_stepSize(256), m_blockSize(2048), m_fmin(40), - m_fmax(1000), + m_fmax(1600), m_yin(2048, inputSampleRate, 0.0), m_outNoF0(0), m_outNoPeriodicity(0),