Mercurial > hg > nnls-chroma
comparison Chordino.cpp @ 42:d01f94d58ef0 matthiasm-plugin
* added new parameter that toggles NNLS
author | matthiasm |
---|---|
date | Sun, 24 Oct 2010 20:43:11 +0900 |
parents | d6bb9b43ac1c |
children | 131801714118 |
comparison
equal
deleted
inserted
replaced
41:d6bb9b43ac1c | 42:d01f94d58ef0 |
---|---|
221 Semitone-spaced log-frequency spectrum derived from the tuned log-freq spectrum above. the spectrum | 221 Semitone-spaced log-frequency spectrum derived from the tuned log-freq spectrum above. the spectrum |
222 is inferred using a non-negative least squares algorithm. | 222 is inferred using a non-negative least squares algorithm. |
223 Three different kinds of chromagram are calculated, "treble", "bass", and "both" (which means | 223 Three different kinds of chromagram are calculated, "treble", "bass", and "both" (which means |
224 bass and treble stacked onto each other). | 224 bass and treble stacked onto each other). |
225 **/ | 225 **/ |
226 if (m_dictID == 1) { | 226 if (m_useNNLS == 0) { |
227 cerr << "[Chordino Plugin] Mapping to semitone spectrum and chroma ... "; | 227 cerr << "[Chordino Plugin] Mapping to semitone spectrum and chroma ... "; |
228 } else { | 228 } else { |
229 cerr << "[Chordino Plugin] Performing NNLS and mapping to chroma ... "; | 229 cerr << "[Chordino Plugin] Performing NNLS and mapping to chroma ... "; |
230 } | 230 } |
231 | 231 |
263 vector<float> basschroma = vector<float>(12, 0); | 263 vector<float> basschroma = vector<float>(12, 0); |
264 float currval; | 264 float currval; |
265 unsigned iSemitone = 0; | 265 unsigned iSemitone = 0; |
266 | 266 |
267 if (some_b_greater_zero) { | 267 if (some_b_greater_zero) { |
268 if (m_dictID == 1) { | 268 if (m_useNNLS == 0) { |
269 for (unsigned iNote = 2; iNote < nNote - 2; iNote += 3) { | 269 for (unsigned iNote = 2; iNote < nNote - 2; iNote += 3) { |
270 currval = 0; | 270 currval = 0; |
271 currval += b[iNote + 1 + -1] * 0.5; | 271 currval += b[iNote + 1 + -1] * 0.5; |
272 currval += b[iNote + 1 + 0] * 1.0; | 272 currval += b[iNote + 1 + 0] * 1.0; |
273 currval += b[iNote + 1 + 1] * 0.5; | 273 currval += b[iNote + 1 + 1] * 0.5; |