Mercurial > hg > nnls-chroma
diff chromamethods.cpp @ 74:b80144039d8f matthiasm-plugin
slightly raised weight for the N chord -- better detection of non-harmonic parts
author | Matthias Mauch <mail@matthiasmauch.net> |
---|---|
date | Fri, 29 Oct 2010 13:14:51 +0900 |
parents | 08d24cc21312 |
children | d398e73b46e0 |
line wrap: on
line diff
--- a/chromamethods.cpp Thu Oct 28 11:36:28 2010 +0200 +++ b/chromamethods.cpp Fri Oct 29 13:14:51 2010 +0900 @@ -385,6 +385,7 @@ // } float exponent = 2.0; + float boostN = 1.1; for (int iChord = 0; iChord < loadedChordDict.size()/24; iChord++) { float sum = 0; @@ -396,7 +397,11 @@ // loadedChordDict[24 * iChord + iST] -= sum/24; stand += pow(abs(loadedChordDict[24 * iChord + iST]),exponent)/24; } - stand = pow(stand,(float)1.0/exponent); + if (iChord < loadedChordDict.size()/24 - 1) { + stand = pow(stand,(float)1.0/exponent); + } else { + stand = pow(stand,(float)1.0/exponent) / boostN; + } for (int iST = 0; iST < 24; ++iST) { loadedChordDict[24 * iChord + iST] /= stand; }