changeset 9:9853fe9c7820

Introduce some local variation to the global level, with mixed results
author Chris Cannam
date Tue, 22 Jul 2014 13:18:33 +0100
parents 355fb9ea3888
children 46ed42184699
files flattendynamics-ladspa.cpp
diffstat 1 files changed, 11 insertions(+), 4 deletions(-) [+]
line wrap: on
line diff
--- a/flattendynamics-ladspa.cpp	Tue Jul 22 11:53:30 2014 +0100
+++ b/flattendynamics-ladspa.cpp	Tue Jul 22 13:18:33 2014 +0100
@@ -9,8 +9,8 @@
 using std::endl;
 
 const float longTermSeconds = 4.f;
-const float shortTermSeconds = 0.5f;
-const float catchUpSeconds = 0.1f;
+const float shortTermSeconds = 1.f;
+const float catchUpSeconds = 0.2f;
 const float targetMaxRMS = 0.07f;
 const float maxGain = 20.f;
 
@@ -206,9 +206,16 @@
         m_maxRmsShortTerm = m_rmsShortTerm;
     }
 
-    float fixedGain = targetMaxRMS / m_maxRmsShortTerm;
+    float fixedGain = targetMaxRMS / m_maxRmsLongTerm;
 
-    float targetGain = fixedGain;
+    float frac = m_rmsShortTerm / m_maxRmsShortTerm;
+
+    // push up toward top of 0,1 range
+    frac = pow(frac, 0.3);
+
+    float targetRMS = (frac * m_maxRmsShortTerm);
+
+    float targetGain = fixedGain * (targetRMS / m_rmsShortTerm);
 
 /*