changeset 213:5bde003a43a9

Make source sparsity configurable in instrument pack as well as pitch sparsity; make both equal to 1 for piano templates
author Chris Cannam
date Tue, 15 Jul 2014 13:28:25 +0100
parents 8f48b65a6ef2
children c0779464b792
files src/EM.h src/Instruments.cpp src/Instruments.h src/Silvet.cpp
diffstat 4 files changed, 8 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/src/EM.h	Tue Jul 15 13:26:56 2014 +0100
+++ b/src/EM.h	Tue Jul 15 13:28:25 2014 +0100
@@ -27,6 +27,7 @@
     ~EM();
 
     void setPitchSparsity(float sparsity) { m_pitchSparsity = sparsity; }
+    void setSourceSparsity(float sparsity) { m_sourceSparsity = sparsity; }
 
     int getBinCount() const { return m_binCount; }
     int getNoteCount() const { return m_noteCount; }
--- a/src/Instruments.cpp	Tue Jul 15 13:26:56 2014 +0100
+++ b/src/Instruments.cpp	Tue Jul 15 13:28:25 2014 +0100
@@ -132,9 +132,11 @@
 			 "Piano",
 			 pianoTemplates);
 //    piano.maxPolyphony = 8;
-//    piano.levelThreshold = 3;
+//    piano.levelThreshold = 4;
     piano.maxPolyphony = 5;
     piano.levelThreshold = 6;
+    piano.pitchSparsity = 1.0;
+    piano.sourceSparsity = 1.0;
     if (isOK(piano)) {
 	ii.push_back(piano);
     }
@@ -145,6 +147,7 @@
     for (int i = 0;
 	 i < int(sizeof(simpleInstruments)/sizeof(simpleInstruments[0]));
 	 i += 2) {
+
 	vector<Templates> tt;
 	Templates t = templatesFor(simpleInstruments[i+1]);
 	tt.push_back(t);
--- a/src/Instruments.h	Tue Jul 15 13:26:56 2014 +0100
+++ b/src/Instruments.h	Tue Jul 15 13:28:25 2014 +0100
@@ -42,6 +42,7 @@
 
     int maxPolyphony; // realistic practical limit, not a theoretical one
     float pitchSparsity;
+    float sourceSparsity;
     float levelThreshold;
 
     std::string name;
@@ -64,6 +65,7 @@
 	highestNote(highest),
         maxPolyphony(5),
         pitchSparsity(1.1),
+        sourceSparsity(1.2),
         levelThreshold(5),
 	name(n),
 	templates(tt) { }
--- a/src/Silvet.cpp	Tue Jul 15 13:26:56 2014 +0100
+++ b/src/Silvet.cpp	Tue Jul 15 13:28:25 2014 +0100
@@ -475,6 +475,7 @@
         EM em(&pack, m_hqMode);
 
         em.setPitchSparsity(pack.pitchSparsity);
+        em.setSourceSparsity(pack.sourceSparsity);
 
         for (int j = 0; j < iterations; ++j) {
             em.iterate(filtered.at(i).data());