# HG changeset patch # User Chris Cannam # Date 1406031513 -3600 # Node ID 9853fe9c7820d64e5ef210dcc50e212c575ddb16 # Parent 355fb9ea3888347a6fb04d34b3f94be67e5a8494 Introduce some local variation to the global level, with mixed results diff -r 355fb9ea3888 -r 9853fe9c7820 flattendynamics-ladspa.cpp --- 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); /*