Revert "Fix PeakController attack/decay (#7566)" (#7871)

Prior to commit b5de1d50e, audible zipper artifacts were present when
using the PeakController on a bus to control the volume of another bus
for sidechain compression. The bus that had its volume reduced was the
one which produced audible artifacts.

Commit b5de1d50e introduced LERP to PeakController to smooth out its
signal, which eliminated the zipper artifacts. However, this had the
side effect of increased latency even when both attack and decay
settings were set to zero.

Until a more robust solution is implemented, reverting this change
eliminates the latency by eliminating the lerp, but reintroduces audible
zipper artifacts.
This commit is contained in:
cyberrumor
2025-05-02 08:04:47 -07:00
committed by GitHub
parent 928b72ab36
commit 41093efcbe
3 changed files with 14 additions and 14 deletions

View File

@@ -132,18 +132,8 @@ Effect::ProcessStatus PeakControllerEffect::processImpl(SampleFrame* buf, const
float curRMS = sqrt_neg(sum / frames);
const float tres = c.m_tresholdModel.value();
const float amount = c.m_amountModel.value() * c.m_amountMultModel.value();
const float attack = 1.0f - c.m_attackModel.value();
const float decay = 1.0f - c.m_decayModel.value();
curRMS = qAbs( curRMS ) < tres ? 0.0f : curRMS;
float target = c.m_baseModel.value() + amount * curRMS;
// Use decay when the volume is decreasing, attack otherwise.
// Since direction can change as often as every sampleBuffer, it's difficult
// to witness attack/decay working in isolation unless using large buffer sizes.
const float t = target < m_lastSample ? decay : attack;
// Set m_lastSample to the interpolation between itself and target.
// When t is 1.0, m_lastSample snaps to target. When t is 0.0, m_lastSample shouldn't change.
m_lastSample = std::clamp(m_lastSample + t * (target - m_lastSample), 0.0f, 1.0f);
m_lastSample = qBound( 0.0f, c.m_baseModel.value() + amount * curRMS, 1.0f );
return ProcessStatus::Continue;
}