v2.1.1 release: delay-click fix + internal consolidation
Mirror of Lyrebird dev HEAD (9f791c7c) minus maintainer-only paths. Patch release: fixes the allpass fractional-delay click (DelayLine/CombFilter/AllpassFilter/ DelayLineFeedback under a modulated delay) and lands the internal code-quality consolidation pass (~160 deduped sites + shared base classes/helpers, bit-identical output). No public API removed or changed. See RELEASES.md. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
@@ -0,0 +1,47 @@
|
||||
// DelayLineAllpassModulationTests.swift
|
||||
// Lyrebird
|
||||
//
|
||||
// Copyright (c) 2026 Joshua Parmenter / realizedsound
|
||||
// SPDX-License-Identifier: MIT
|
||||
|
||||
import Testing
|
||||
@testable @_spi(LyrebirdExtensions) import LyrebirdSynth
|
||||
|
||||
// MARK: - DelayLineAllpassModulationTests
|
||||
|
||||
/// Regression guard for the allpass fractional-delay interpolator's recursive-state
|
||||
/// handling. When the delay lands on an exact integer sample (`frac == 0`) the interpolator
|
||||
/// bypasses to the integer-delayed sample; its recursive state must record that sample as
|
||||
/// the previous output. Leaving it stale (freezing the pre-bypass value) clicks when the
|
||||
/// delay dwells on an integer and then moves off. The timeline dwells on an exact integer
|
||||
/// then ramps a fractional delay out, and the allpass step is compared against the same
|
||||
/// modulation through `.linear` interpolation, which has no recursive state and stays smooth.
|
||||
@MainActor
|
||||
@Suite("DelayLine allpass modulation")
|
||||
struct DelayLineAllpassModulationTests {
|
||||
|
||||
/// Allpass-vs-linear sample-step ratio tolerated. Correct state handling keeps this
|
||||
/// ~1×; freezing the stale state drives it past 3× for DelayLine.
|
||||
let clickRatioLimit: Double = 2.0
|
||||
|
||||
@Test func modulatedAllpassDelayStaysClickFreeThroughIntegerDwell() throws {
|
||||
let timeline: [Double] = modulatedDelayDwellTimeline()
|
||||
let linear: [Double] = try renderModulatedDelay(delaySamples: timeline) { input, modulator, maxDelay in
|
||||
DelayLine(input: input, maxDelay: maxDelay, delay: modulator,
|
||||
sampleRate: delaySweepSampleRate, interpolation: .linear)
|
||||
}
|
||||
let allpass: [Double] = try renderModulatedDelay(delaySamples: timeline) { input, modulator, maxDelay in
|
||||
DelayLine(input: input, maxDelay: maxDelay, delay: modulator,
|
||||
sampleRate: delaySweepSampleRate, interpolation: .allpass)
|
||||
}
|
||||
|
||||
#expect(allpass.allSatisfy { $0.isFinite }, "allpass output must be finite")
|
||||
let linearStep: Double = maxAbsDelta(linear)
|
||||
let allpassStep: Double = maxAbsDelta(allpass)
|
||||
#expect(linearStep > 0, "linear reference should have non-zero motion")
|
||||
#expect(
|
||||
allpassStep < clickRatioLimit * linearStep,
|
||||
"modulated allpass delay clicks at integer dwell/crossing: allpass maxΔ \(allpassStep) vs linear \(linearStep)"
|
||||
)
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,48 @@
|
||||
// DelayLineFeedbackAllpassModulationTests.swift
|
||||
// Lyrebird
|
||||
//
|
||||
// Copyright (c) 2026 Joshua Parmenter / realizedsound
|
||||
// SPDX-License-Identifier: MIT
|
||||
|
||||
import Testing
|
||||
@testable @_spi(LyrebirdExtensions) import LyrebirdSynth
|
||||
|
||||
// MARK: - DelayLineFeedbackAllpassModulationTests
|
||||
|
||||
/// Regression guard for the allpass fractional-delay interpolator's recursive-state
|
||||
/// handling in `DelayLineFeedback` under delay modulation. On an exact integer delay
|
||||
/// (`frac == 0`) the interpolator must record the integer-delayed sample as its previous
|
||||
/// output; freezing the stale value clicks when the delay moves back off the integer. Measured against
|
||||
/// the same modulation through `.linear` interpolation. See
|
||||
/// `DelayLineAllpassModulationTests` for the timeline rationale.
|
||||
@MainActor
|
||||
@Suite("DelayLineFeedback allpass modulation")
|
||||
struct DelayLineFeedbackAllpassModulationTests {
|
||||
|
||||
let clickRatioLimit: Double = 2.0
|
||||
/// Moderate feedback — high feedback rings enough to mask the click in the global metric.
|
||||
let feedbackDecayTime: Double = 0.012
|
||||
|
||||
@Test func modulatedAllpassDelayStaysClickFreeThroughIntegerDwell() throws {
|
||||
let timeline: [Double] = modulatedDelayDwellTimeline()
|
||||
let linear: [Double] = try renderModulatedDelay(delaySamples: timeline) { input, modulator, maxDelay in
|
||||
DelayLineFeedback(input: input, maxDelay: maxDelay, delay: modulator,
|
||||
decayTime: feedbackDecayTime, sampleRate: delaySweepSampleRate,
|
||||
interpolation: .linear)
|
||||
}
|
||||
let allpass: [Double] = try renderModulatedDelay(delaySamples: timeline) { input, modulator, maxDelay in
|
||||
DelayLineFeedback(input: input, maxDelay: maxDelay, delay: modulator,
|
||||
decayTime: feedbackDecayTime, sampleRate: delaySweepSampleRate,
|
||||
interpolation: .allpass)
|
||||
}
|
||||
|
||||
#expect(allpass.allSatisfy { $0.isFinite }, "allpass output must be finite")
|
||||
let linearStep: Double = maxAbsDelta(linear)
|
||||
let allpassStep: Double = maxAbsDelta(allpass)
|
||||
#expect(linearStep > 0, "linear reference should have non-zero motion")
|
||||
#expect(
|
||||
allpassStep < clickRatioLimit * linearStep,
|
||||
"modulated allpass feedback delay clicks at integer dwell exit: allpass maxΔ \(allpassStep) vs linear \(linearStep)"
|
||||
)
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,50 @@
|
||||
// AllpassFilterModulationTests.swift
|
||||
// Lyrebird
|
||||
//
|
||||
// Copyright (c) 2026 Joshua Parmenter / realizedsound
|
||||
// SPDX-License-Identifier: MIT
|
||||
|
||||
import Testing
|
||||
@testable @_spi(LyrebirdExtensions) import LyrebirdSynth
|
||||
|
||||
// MARK: - AllpassFilterModulationTests
|
||||
|
||||
/// Regression guard for the allpass fractional-delay interpolator's recursive-state
|
||||
/// handling in `AllpassFilter` under delay modulation. The Schroeder allpass reads both an
|
||||
/// input- and an output-history buffer through the interpolator; at an exact integer delay
|
||||
/// (`frac == 0`) each interpolator must record its integer-delayed read as the previous
|
||||
/// output. This two-history form clicks both if the state is zeroed and if the stale
|
||||
/// pre-bypass value is frozen across an integer dwell. Measured against
|
||||
/// the same modulation through `.linear` interpolation. See
|
||||
/// `DelayLineAllpassModulationTests` for the timeline rationale.
|
||||
@MainActor
|
||||
@Suite("AllpassFilter allpass modulation")
|
||||
struct AllpassFilterModulationTests {
|
||||
|
||||
let clickRatioLimit: Double = 2.0
|
||||
/// Moderate feedback — high feedback rings enough to mask the click in the global metric.
|
||||
let feedbackDecayTime: Double = 0.012
|
||||
|
||||
@Test func modulatedAllpassDelayStaysClickFreeThroughIntegerDwell() throws {
|
||||
let timeline: [Double] = modulatedDelayDwellTimeline()
|
||||
let linear: [Double] = try renderModulatedDelay(delaySamples: timeline) { input, modulator, maxDelay in
|
||||
AllpassFilter(input: input, maxDelay: maxDelay, delay: modulator,
|
||||
decayTime: feedbackDecayTime, sampleRate: delaySweepSampleRate,
|
||||
interpolation: .linear)
|
||||
}
|
||||
let allpass: [Double] = try renderModulatedDelay(delaySamples: timeline) { input, modulator, maxDelay in
|
||||
AllpassFilter(input: input, maxDelay: maxDelay, delay: modulator,
|
||||
decayTime: feedbackDecayTime, sampleRate: delaySweepSampleRate,
|
||||
interpolation: .allpass)
|
||||
}
|
||||
|
||||
#expect(allpass.allSatisfy { $0.isFinite }, "allpass output must be finite")
|
||||
let linearStep: Double = maxAbsDelta(linear)
|
||||
let allpassStep: Double = maxAbsDelta(allpass)
|
||||
#expect(linearStep > 0, "linear reference should have non-zero motion")
|
||||
#expect(
|
||||
allpassStep < clickRatioLimit * linearStep,
|
||||
"modulated allpass filter clicks at integer dwell exit: allpass maxΔ \(allpassStep) vs linear \(linearStep)"
|
||||
)
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,50 @@
|
||||
// CombFilterAllpassModulationTests.swift
|
||||
// Lyrebird
|
||||
//
|
||||
// Copyright (c) 2026 Joshua Parmenter / realizedsound
|
||||
// SPDX-License-Identifier: MIT
|
||||
|
||||
import Testing
|
||||
@testable @_spi(LyrebirdExtensions) import LyrebirdSynth
|
||||
|
||||
// MARK: - CombFilterAllpassModulationTests
|
||||
|
||||
/// Regression guard for the allpass fractional-delay interpolator's recursive-state
|
||||
/// handling in `CombFilter` under delay modulation. On an exact integer delay
|
||||
/// (`frac == 0`) the interpolator must record the integer-delayed sample as its previous
|
||||
/// output; freezing the stale value clicks when the delay moves back off the integer. Measured against
|
||||
/// the same modulation through `.linear` interpolation. See
|
||||
/// `DelayLineAllpassModulationTests` for the timeline rationale.
|
||||
@MainActor
|
||||
@Suite("CombFilter allpass modulation")
|
||||
struct CombFilterAllpassModulationTests {
|
||||
|
||||
let clickRatioLimit: Double = 2.0
|
||||
/// Moderate feedback. High feedback rings strongly enough to mask the state-handling
|
||||
/// click in the global step metric; this level keeps the stale-state (frozen) click well
|
||||
/// above the linear-interpolation reference while the fix stays ~1×.
|
||||
let feedbackDecayTime: Double = 0.012
|
||||
|
||||
@Test func modulatedAllpassDelayStaysClickFreeThroughIntegerDwell() throws {
|
||||
let timeline: [Double] = modulatedDelayDwellTimeline()
|
||||
let linear: [Double] = try renderModulatedDelay(delaySamples: timeline) { input, modulator, maxDelay in
|
||||
CombFilter(input: input, maxDelay: maxDelay, delay: modulator,
|
||||
decayTime: feedbackDecayTime, sampleRate: delaySweepSampleRate,
|
||||
interpolation: .linear)
|
||||
}
|
||||
let allpass: [Double] = try renderModulatedDelay(delaySamples: timeline) { input, modulator, maxDelay in
|
||||
CombFilter(input: input, maxDelay: maxDelay, delay: modulator,
|
||||
decayTime: feedbackDecayTime, sampleRate: delaySweepSampleRate,
|
||||
interpolation: .allpass)
|
||||
}
|
||||
|
||||
#expect(allpass.allSatisfy { $0.isFinite }, "allpass output must be finite")
|
||||
let linearStep: Double = maxAbsDelta(linear)
|
||||
let allpassStep: Double = maxAbsDelta(allpass)
|
||||
#expect(linearStep > 0, "linear reference should have non-zero motion")
|
||||
#expect(
|
||||
allpassStep < clickRatioLimit * linearStep,
|
||||
"modulated allpass comb clicks at integer dwell exit: allpass maxΔ \(allpassStep) vs linear \(linearStep)"
|
||||
)
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user