changeset 151:246de093f0f1 refactors

Make noise an option in the plugin: on by default, and therefore also switch on silence by default
author Chris Cannam
date Fri, 23 Jan 2015 09:20:04 +0000
parents b79151bb75af
children 4e7f8653c643 d6df9fe7b12f
files src/FeatureConditioner.h src/MatchVampPlugin.cpp
diffstat 2 files changed, 15 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/src/FeatureConditioner.h	Thu Jan 22 17:25:24 2015 +0000
+++ b/src/FeatureConditioner.h	Fri Jan 23 09:20:04 2015 +0000
@@ -63,7 +63,7 @@
 	Parameters() :
 	    norm(NormaliseToSum1),
 	    order(OutputRectifiedDerivative),
-	    silenceThreshold(0.0),
+	    silenceThreshold(0.01),
 	    decay(0.99)
 	{}
 
--- a/src/MatchVampPlugin.cpp	Thu Jan 22 17:25:24 2015 +0000
+++ b/src/MatchVampPlugin.cpp	Fri Jan 23 09:20:04 2015 +0000
@@ -214,6 +214,16 @@
     desc.defaultValue = m_defaultFcParams.silenceThreshold;
     desc.isQuantized = false;
     list.push_back(desc);
+
+    desc.identifier = "noise";
+    desc.name = "Mix in Noise";
+    desc.description = "Whether to mix in a small constant white noise term when calculating feature distance. This can improve alignment against sources containing cleanly synthesised audio.";
+    desc.minValue = 0;
+    desc.maxValue = 1;
+    desc.defaultValue = (int)m_defaultDParams.noise;
+    desc.isQuantized = true;
+    desc.quantizeStep = 1;
+    list.push_back(desc);
     
     desc.identifier = "gradientlimit";
     desc.name = "Gradient Limit";
@@ -283,6 +293,8 @@
         return m_smooth ? 1.0 : 0.0;
     } else if (name == "silencethreshold") {
         return m_fcParams.silenceThreshold;
+    } else if (name == "noise") {
+        return m_dParams.noise;
     }
     
     return 0.0;
@@ -311,6 +323,8 @@
         m_smooth = (value > 0.5);
     } else if (name == "silencethreshold") {
         m_fcParams.silenceThreshold = value;
+    } else if (name == "noise") {
+        m_dParams.noise = (DistanceMetric::NoiseAddition)(int(value + 0.1));
     }
 }