Address Shimmer review: init param docs + deterministic generator test
- Add init-level /// - Parameters: block to ShimmerReverb (dual-location docs). - Add a pinned-value generator test: with decay/shimmer/damp = 0 the tank is a unity-DC allpass chain, so two DC levels scale exactly linearly (ratio 2.0, output-gain independent). Suite 256. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
@@ -81,6 +81,20 @@ struct ShimmerReverbTests {
|
||||
#expect(!hasNonSilentOutput(samples), "shimmer reverb rang with no input")
|
||||
}
|
||||
|
||||
@Test func passesDCWithUnityGainAndLinearScaling() throws {
|
||||
// With decay = shimmer = damp = 0, the tank is just the input through two Schroeder
|
||||
// allpasses (unity at DC steady state) delayed by `size`. The output is therefore a fixed
|
||||
// gain (the harness output gain/pan) times the DC input — exactly linear. Compare two DC
|
||||
// levels at a settled frame so the harness scale cancels: the ratio must be 2.0.
|
||||
let high: [Float] = try render(oscFreq: nil, dc: 1.0, size: 0.01, decay: 0.0, shimmer: 0.0)
|
||||
let low: [Float] = try render(oscFreq: nil, dc: 0.5, size: 0.01, decay: 0.0, shimmer: 0.0)
|
||||
let frame: Int = 1500 // past the size delay + allpass settling, within the read window
|
||||
let h: Double = Double(high[frame * 2])
|
||||
let l: Double = Double(low[frame * 2])
|
||||
#expect(abs(h) > 1e-3, "settled DC output should be non-zero")
|
||||
#expect(abs(h / l - 2.0) < 0.01, "DC gain should be exactly linear (ratio 2.0)")
|
||||
}
|
||||
|
||||
@Test func decayChangesTheTail() throws {
|
||||
// Small tank so feedback round-trips compound within the reader's window; different decay
|
||||
// must change the tail (direction-agnostic — a tuned comb is not monotonic in level).
|
||||
|
||||
Reference in New Issue
Block a user