# HG changeset patch # User Chris Cannam # Date 1396717833 -3600 # Node ID c0c4a945577ad7b01deed28bcbf1f88bd8264afa # Parent b49597c93132e5f171821ae55b1bd1340c962555 Sparsity parameters diff -r b49597c93132 -r c0c4a945577a src/EM.cpp --- 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 +#include #include @@ -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]); } diff -r b49597c93132 -r c0c4a945577a src/EM.h --- a/src/EM.h Sat Apr 05 17:57:50 2014 +0100 +++ b/src/EM.h Sat Apr 05 18:10:33 2014 +0100 @@ -50,6 +50,9 @@ int m_notes; int m_bins; int m_instruments; + + double m_pitchSparsity; + double m_sourceSparsity; int m_lowest; int m_highest;