Mercurial > hg > silvet
changeset 42:c0c4a945577a
Sparsity parameters
author | Chris Cannam |
---|---|
date | Sat, 05 Apr 2014 18:10:33 +0100 |
parents | b49597c93132 |
children | 7de9fe5e9fab |
files | src/EM.cpp src/EM.h |
diffstat | 2 files changed, 13 insertions(+), 1 deletions(-) [+] |
line wrap: on
line diff
--- a/src/EM.cpp Sat Apr 05 17:57:50 2014 +0100 +++ b/src/EM.cpp Sat Apr 05 18:10:33 2014 +0100 @@ -18,6 +18,7 @@ #include "data/include/templates.h" #include <cstdlib> +#include <cmath> #include <iostream> @@ -32,7 +33,9 @@ EM::EM() : m_notes(SILVET_TEMPLATE_NOTE_COUNT), m_bins(SILVET_TEMPLATE_HEIGHT), - m_instruments(SILVET_TEMPLATE_COUNT) + m_instruments(SILVET_TEMPLATE_COUNT), + m_pitchSparsity(1.1), + m_sourceSparsity(1.3) { m_lowest = 0; m_highest = m_notes - 1; @@ -138,6 +141,9 @@ } } } + if (m_pitchSparsity != 1.0) { + newPitches[n] = pow(newPitches[n], m_pitchSparsity); + } } normalise(newPitches); @@ -154,6 +160,9 @@ newSources[i][n] += w[j] * m_q[j] * pitch * source; } } + if (m_sourceSparsity != 1.0) { + newSources[i][n] = pow(newSources[i][n], m_sourceSparsity); + } } normalise(newSources[i]); }