v1.6.4 release: LookAheadLimiter releaseTime decoupled from lookAheadTime
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
@@ -480,6 +480,34 @@ struct LookAheadLimiterTests {
|
||||
let tailMax: Double = tail.map { abs($0) }.max() ?? 0
|
||||
#expect(tailMax < maxAmp * 10.0) // generous bound; really we want "small"
|
||||
}
|
||||
|
||||
/// `releaseTime` is decoupled from `lookAheadTime`: with the look-ahead window held
|
||||
/// fixed, two different release times must produce different gain-recovery behaviour
|
||||
/// (hence different output) on a low-frequency signal that crosses the ceiling on its
|
||||
/// peaks and dips below between them — while both still respect the ceiling.
|
||||
@Test func releaseTimeIndependentOfLookAhead() {
|
||||
let maxAmp: Double = 0.3
|
||||
func run(_ releaseTime: Double) -> [Double] {
|
||||
let sine: OscSin.Audio = OscSin.Audio(freq: 60.0, mul: 1.0)
|
||||
let lim: LookAheadLimiter = LookAheadLimiter(
|
||||
in: sine, maxAmplitude: maxAmp,
|
||||
lookAheadTime: 0.005, releaseTime: releaseTime, sampleRate: sr)
|
||||
return collectBlocks(lim, engine: engine, blocks: 100)
|
||||
}
|
||||
let fast: [Double] = run(0.005)
|
||||
let slow: [Double] = run(0.200)
|
||||
// Ceiling holds for both release settings.
|
||||
#expect(fast.allSatisfy { abs($0) <= maxAmp + 0.001 })
|
||||
#expect(slow.allSatisfy { abs($0) <= maxAmp + 0.001 })
|
||||
// Different release → different waveform.
|
||||
let tailFast: [Double] = Array(fast.suffix(engine.blockSize * 50))
|
||||
let tailSlow: [Double] = Array(slow.suffix(engine.blockSize * 50))
|
||||
let ssd: Double = zip(tailFast, tailSlow).reduce(0.0) { acc, pair in
|
||||
let diff: Double = pair.0 - pair.1
|
||||
return acc + diff * diff
|
||||
}
|
||||
#expect(ssd > 0, "releaseTime had no effect on limiter output")
|
||||
}
|
||||
}
|
||||
|
||||
// MARK: - Compressor Tests
|
||||
|
||||
Reference in New Issue
Block a user