MCPcopy Create free account
hub / github.com/LabSound/LabSound / kAtSlope

Method kAtSlope

src/internal/src/DynamicsCompressorKernel.cpp:129–160  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

127}
128
129float DynamicsCompressorKernel::kAtSlope(float desiredSlope)
130{
131 float xDb = m_dbThreshold + m_dbKnee;
132 float x = decibelsToLinear(xDb);
133
134 // Approximate k given initial values.
135 float minK = 0.1f;
136 float maxK = 10000;
137 float k = 5;
138
139 for (int i = 0; i < 15; ++i)
140 {
141 // A high value for k will more quickly asymptotically approach a slope of 0.
142 float slope = slopeAt(x, k);
143
144 if (slope < desiredSlope)
145 {
146 // k is too high.
147 maxK = k;
148 }
149 else
150 {
151 // k is too low.
152 minK = k;
153 }
154
155 // Re-calculate based on geometric mean.
156 k = sqrtf(minK * maxK);
157 }
158
159 return k;
160}
161
162float DynamicsCompressorKernel::updateStaticCurveParameters(float dbThreshold, float dbKnee, float ratio)
163{

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected