# HG changeset patch # User matthiasm # Date 1394124472 0 # Node ID b39d6745c59626a90d40140812eb52e03dbc0e9c # Parent 85eb802a809183825de95d1524a959fb224af412 changes to frequency range, dis-favouring low amplitude soudns diff -r 85eb802a8091 -r b39d6745c596 MonoNoteParameters.cpp --- a/MonoNoteParameters.cpp Fri Feb 28 19:40:12 2014 +0000 +++ b/MonoNoteParameters.cpp Thu Mar 06 16:47:52 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 85eb802a8091 -r b39d6745c596 MonoPitchHMM.cpp --- a/MonoPitchHMM.cpp Fri Feb 28 19:40:12 2014 +0000 +++ b/MonoPitchHMM.cpp Thu Mar 06 16:47:52 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 85eb802a8091 -r b39d6745c596 PYinVamp.cpp --- a/PYinVamp.cpp Fri Feb 28 19:40:12 2014 +0000 +++ b/PYinVamp.cpp Thu Mar 06 16:47:52 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 85eb802a8091 -r b39d6745c596 YinUtil.cpp --- a/YinUtil.cpp Fri Feb 28 19:40:12 2014 +0000 +++ b/YinUtil.cpp Thu Mar 06 16:47:52 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 85eb802a8091 -r b39d6745c596 YinVamp.cpp --- a/YinVamp.cpp Fri Feb 28 19:40:12 2014 +0000 +++ b/YinVamp.cpp Thu Mar 06 16:47:52 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),