Mercurial > hg > pyin
comparison MonoNoteHMM.cpp @ 90:b087967c4417
removed fourth "inter-note" state because it wasn't used anyway
author | matthiasm |
---|---|
date | Wed, 07 Jan 2015 15:22:03 +0000 |
parents | 354c2c421661 |
children | 854d9403c5be |
comparison
equal
deleted
inserted
replaced
89:354c2c421661 | 90:b087967c4417 |
---|---|
163 // the "easy" transitions from silent state | 163 // the "easy" transitions from silent state |
164 from.push_back(index+2); | 164 from.push_back(index+2); |
165 to.push_back(index+2); | 165 to.push_back(index+2); |
166 transProb.push_back(par.pSilentSelftrans); | 166 transProb.push_back(par.pSilentSelftrans); |
167 | 167 |
168 // the "easy" inter state transition | 168 // // the "easy" inter state transition |
169 from.push_back(index+3); | 169 // from.push_back(index+3); |
170 to.push_back(index+3); | 170 // to.push_back(index+3); |
171 transProb.push_back(par.pInterSelftrans); | 171 // transProb.push_back(par.pInterSelftrans); |
172 | 172 |
173 // the more complicated transitions from the silent and inter state | 173 // the more complicated transitions from the silent and inter state |
174 double probSumSilent = 0; | 174 double probSumSilent = 0; |
175 double probSumInter = 0; | 175 // double probSumInter = 0; |
176 vector<double> tempTransProbInter; | 176 // vector<double> tempTransProbInter; |
177 vector<double> tempTransProbSilent; | 177 vector<double> tempTransProbSilent; |
178 for (size_t jPitch = 0; jPitch < (par.nS * par.nPPS); ++jPitch) | 178 for (size_t jPitch = 0; jPitch < (par.nS * par.nPPS); ++jPitch) |
179 { | 179 { |
180 int fromPitch = iPitch; | 180 int fromPitch = iPitch; |
181 int toPitch = jPitch; | 181 int toPitch = jPitch; |
189 { | 189 { |
190 size_t toIndex = jPitch * par.nSPP; // note attack index | 190 size_t toIndex = jPitch * par.nSPP; // note attack index |
191 | 191 |
192 double tempWeightSilent = boost::math::pdf(noteDistanceDistr, | 192 double tempWeightSilent = boost::math::pdf(noteDistanceDistr, |
193 semitoneDistance); | 193 semitoneDistance); |
194 double tempWeightInter = semitoneDistance == 0 ? | 194 // double tempWeightInter = semitoneDistance == 0 ? |
195 0 : tempWeightSilent; | 195 // 0 : tempWeightSilent; |
196 probSumSilent += tempWeightSilent; | 196 probSumSilent += tempWeightSilent; |
197 probSumInter += tempWeightInter; | 197 // probSumInter += tempWeightInter; |
198 | 198 |
199 tempTransProbSilent.push_back(tempWeightSilent); | 199 tempTransProbSilent.push_back(tempWeightSilent); |
200 tempTransProbInter.push_back(tempWeightInter); | 200 // tempTransProbInter.push_back(tempWeightInter); |
201 | 201 |
202 from.push_back(index+2); | 202 from.push_back(index+2); |
203 to.push_back(toIndex); | 203 to.push_back(toIndex); |
204 from.push_back(index+3); | 204 // from.push_back(index+3); |
205 to.push_back(toIndex); | 205 // to.push_back(toIndex); |
206 } | 206 } |
207 } | 207 } |
208 for (size_t i = 0; i < tempTransProbSilent.size(); ++i) | 208 for (size_t i = 0; i < tempTransProbSilent.size(); ++i) |
209 { | 209 { |
210 transProb.push_back((1-par.pSilentSelftrans) * tempTransProbSilent[i]/probSumSilent); | 210 transProb.push_back((1-par.pSilentSelftrans) * tempTransProbSilent[i]/probSumSilent); |
211 transProb.push_back((1-par.pInterSelftrans) * tempTransProbInter[i]/probSumInter); | 211 // transProb.push_back((1-par.pInterSelftrans) * tempTransProbInter[i]/probSumInter); |
212 } | 212 } |
213 } | 213 } |
214 } | 214 } |
215 | 215 |
216 double | 216 double |