Mercurial > hg > pyin
comparison MonoNoteHMM.cpp @ 89:354c2c421661
some parameter changes for note and also pitch track (this may not be wise, since I made some different changes for the tony branch.. will have to merge at some point)
author | matthiasm |
---|---|
date | Wed, 07 Jan 2015 14:36:30 +0000 |
parents | 5945b8905d1f |
children | b087967c4417 |
comparison
equal
deleted
inserted
replaced
88:585fdda4d7f9 | 89:354c2c421661 |
---|---|
66 minDist = currDist; | 66 minDist = currDist; |
67 minDistProb = pitchProb[iCandidate].second; | 67 minDistProb = pitchProb[iCandidate].second; |
68 minDistCandidate = iCandidate; | 68 minDistCandidate = iCandidate; |
69 } | 69 } |
70 } | 70 } |
71 tempProb = std::pow(minDistProb, par.yinTrust) * boost::math::pdf(pitchDistr[i], pitchProb[minDistCandidate].first); | 71 tempProb = std::pow(minDistProb, par.yinTrust) * |
72 boost::math::pdf(pitchDistr[i], | |
73 pitchProb[minDistCandidate].first); | |
72 } else { | 74 } else { |
73 tempProb = 1; | 75 tempProb = 1; |
74 } | 76 } |
75 tempProbSum += tempProb; | 77 tempProbSum += tempProb; |
76 out[i] = tempProb; | 78 out[i] = tempProb; |
175 vector<double> tempTransProbSilent; | 177 vector<double> tempTransProbSilent; |
176 for (size_t jPitch = 0; jPitch < (par.nS * par.nPPS); ++jPitch) | 178 for (size_t jPitch = 0; jPitch < (par.nS * par.nPPS); ++jPitch) |
177 { | 179 { |
178 int fromPitch = iPitch; | 180 int fromPitch = iPitch; |
179 int toPitch = jPitch; | 181 int toPitch = jPitch; |
180 double semitoneDistance = std::abs(fromPitch - toPitch) * 1.0 / par.nPPS; | 182 double semitoneDistance = |
183 std::abs(fromPitch - toPitch) * 1.0 / par.nPPS; | |
181 | 184 |
182 // if (std::fmod(semitoneDistance, 1) == 0 && semitoneDistance > par.minSemitoneDistance) | 185 // if (std::fmod(semitoneDistance, 1) == 0 && semitoneDistance > par.minSemitoneDistance) |
183 if (semitoneDistance == 0 || (semitoneDistance > par.minSemitoneDistance && semitoneDistance < par.maxJump)) | 186 if (semitoneDistance == 0 || |
187 (semitoneDistance > par.minSemitoneDistance | |
188 && semitoneDistance < par.maxJump)) | |
184 { | 189 { |
185 size_t toIndex = jPitch * par.nSPP; // note attack index | 190 size_t toIndex = jPitch * par.nSPP; // note attack index |
186 | 191 |
187 double tempWeightSilent = boost::math::pdf(noteDistanceDistr, semitoneDistance); | 192 double tempWeightSilent = boost::math::pdf(noteDistanceDistr, |
188 double tempWeightInter = semitoneDistance == 0 ? 0 : tempWeightSilent; | 193 semitoneDistance); |
194 double tempWeightInter = semitoneDistance == 0 ? | |
195 0 : tempWeightSilent; | |
189 probSumSilent += tempWeightSilent; | 196 probSumSilent += tempWeightSilent; |
190 probSumInter += tempWeightInter; | 197 probSumInter += tempWeightInter; |
191 | 198 |
192 tempTransProbSilent.push_back(tempWeightSilent); | 199 tempTransProbSilent.push_back(tempWeightSilent); |
193 tempTransProbInter.push_back(tempWeightInter); | 200 tempTransProbInter.push_back(tempWeightInter); |