comparison MonoNoteHMM.cpp @ 91:854d9403c5be

note separation based on RMS
author matthiasm
date Wed, 07 Jan 2015 16:30:16 +0000
parents b087967c4417
children 2687ba2cafae
comparison
equal deleted inserted replaced
90:b087967c4417 91:854d9403c5be
47 47
48 vector<double> out = vector<double>(par.n); 48 vector<double> out = vector<double>(par.n);
49 double tempProbSum = 0; 49 double tempProbSum = 0;
50 for (size_t i = 0; i < par.n; ++i) 50 for (size_t i = 0; i < par.n; ++i)
51 { 51 {
52 if (i % 4 != 2) 52 if (i % par.nSPP != 2)
53 { 53 {
54 // std::cerr << getMidiPitch(i) << std::endl; 54 // std::cerr << getMidiPitch(i) << std::endl;
55 double tempProb = 0; 55 double tempProb = 0;
56 if (nCandidate > 0) 56 if (nCandidate > 0)
57 { 57 {
79 } 79 }
80 } 80 }
81 81
82 for (size_t i = 0; i < par.n; ++i) 82 for (size_t i = 0; i < par.n; ++i)
83 { 83 {
84 if (i % 4 != 2) 84 if (i % par.nSPP != 2)
85 { 85 {
86 if (tempProbSum > 0) 86 if (tempProbSum > 0)
87 { 87 {
88 out[i] = out[i] / tempProbSum * pIsPitched; 88 out[i] = out[i] / tempProbSum * pIsPitched;
89 } 89 }
101 // the states are organised as follows: 101 // the states are organised as follows:
102 // 0-2. lowest pitch 102 // 0-2. lowest pitch
103 // 0. attack state 103 // 0. attack state
104 // 1. stable state 104 // 1. stable state
105 // 2. silent state 105 // 2. silent state
106 // 3. inter state 106 // 3-5. second-lowest pitch
107 // 4-6. second-lowest pitch 107 // 3. attack state
108 // 4. attack state
109 // ... 108 // ...
110 109
111 // observation distributions 110 // observation distributions
112 for (size_t iState = 0; iState < par.n; ++iState) 111 for (size_t iState = 0; iState < par.n; ++iState)
113 { 112 {
114 pitchDistr.push_back(boost::math::normal(0,1)); 113 pitchDistr.push_back(boost::math::normal(0,1));
115 if (iState % 4 == 2) 114 if (iState % par.nSPP == 2)
116 { 115 {
117 // silent state starts tracking 116 // silent state starts tracking
118 init.push_back(1.0/(par.nS * par.nPPS)); 117 init.push_back(1.0/(par.nS * par.nPPS));
119 } else { 118 } else {
120 init.push_back(0.0); 119 init.push_back(0.0);
154 153
155 from.push_back(index+1); 154 from.push_back(index+1);
156 to.push_back(index+2); // to silent 155 to.push_back(index+2); // to silent
157 transProb.push_back(par.pStable2Silent); 156 transProb.push_back(par.pStable2Silent);
158 157
159 from.push_back(index+1); 158 // from.push_back(index+1);
160 to.push_back(index+3); // to inter-note 159 // to.push_back(index+3); // to inter-note
161 transProb.push_back(1-par.pStableSelftrans-par.pStable2Silent); 160 // transProb.push_back(1-par.pStableSelftrans-par.pStable2Silent);
162 161
163 // the "easy" transitions from silent state 162 // the "easy" transitions from silent state
164 from.push_back(index+2); 163 from.push_back(index+2);
165 to.push_back(index+2); 164 to.push_back(index+2);
166 transProb.push_back(par.pSilentSelftrans); 165 transProb.push_back(par.pSilentSelftrans);