comparison flattendynamics-ladspa.cpp @ 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
comparison
equal deleted inserted replaced
8:355fb9ea3888 9:9853fe9c7820
7 7
8 using std::cerr; 8 using std::cerr;
9 using std::endl; 9 using std::endl;
10 10
11 const float longTermSeconds = 4.f; 11 const float longTermSeconds = 4.f;
12 const float shortTermSeconds = 0.5f; 12 const float shortTermSeconds = 1.f;
13 const float catchUpSeconds = 0.1f; 13 const float catchUpSeconds = 0.2f;
14 const float targetMaxRMS = 0.07f; 14 const float targetMaxRMS = 0.07f;
15 const float maxGain = 20.f; 15 const float maxGain = 20.f;
16 16
17 const char *const 17 const char *const
18 FlattenDynamics::portNames[PortCount] = 18 FlattenDynamics::portNames[PortCount] =
204 204
205 if (m_rmsShortTerm > m_maxRmsShortTerm) { 205 if (m_rmsShortTerm > m_maxRmsShortTerm) {
206 m_maxRmsShortTerm = m_rmsShortTerm; 206 m_maxRmsShortTerm = m_rmsShortTerm;
207 } 207 }
208 208
209 float fixedGain = targetMaxRMS / m_maxRmsShortTerm; 209 float fixedGain = targetMaxRMS / m_maxRmsLongTerm;
210 210
211 float targetGain = fixedGain; 211 float frac = m_rmsShortTerm / m_maxRmsShortTerm;
212
213 // push up toward top of 0,1 range
214 frac = pow(frac, 0.3);
215
216 float targetRMS = (frac * m_maxRmsShortTerm);
217
218 float targetGain = fixedGain * (targetRMS / m_rmsShortTerm);
212 219
213 /* 220 /*
214 221
215 float frac = m_rmsShortTerm / m_maxRmsLongTerm; 222 float frac = m_rmsShortTerm / m_maxRmsLongTerm;
216 223