Mercurial > hg > tuning-difference
changeset 69:c0b78dcc08e6 feature-alternatives tip
Some experimental feature adjustments - try using diffs between chroma cells (no better at first glance)
author | Chris Cannam |
---|---|
date | Fri, 16 Aug 2019 12:28:58 +0100 |
parents | 8fd1c994f937 |
children | |
files | src/TuningDifference.cpp |
diffstat | 1 files changed, 14 insertions(+), 6 deletions(-) [+] |
line wrap: on
line diff
--- a/src/TuningDifference.cpp Thu Jul 11 16:29:40 2019 +0100 +++ b/src/TuningDifference.cpp Fri Aug 16 12:28:58 2019 +0100 @@ -332,7 +332,13 @@ template<typename T> void addTo(vector<T> &a, const vector<T> &b) { - transform(a.begin(), a.end(), b.begin(), a.begin(), plus<T>()); + int n = int(b.size()); + + for (int i = 0; i < n; ++i) { + int j = (i == 0 ? n-1 : i-1); + T diff = b[i] - b[j]; + a[i] += diff; + } } template<typename T> @@ -348,17 +354,19 @@ if (m_frameCount == 0) return totals; TFeature feature(m_bpo); - double sum = 0.0; + double max = 0.0; for (int i = 0; i < m_bpo; ++i) { double value = totals[i] / m_frameCount; - feature[i] += value; - sum += value; + feature[i] = value; + if (fabs(value) > max) { + max = fabs(value); + } } - if (sum != 0.0) { + if (max > 0.0) { for (int i = 0; i < m_bpo; ++i) { - feature[i] /= sum; + feature[i] /= max; } }