v1.7.2 release: sample-rate-invariant TriodeStage coupling + Mesa/Soldano tone stacks

- TriodeStage coupling DC-blocker corner is now held constant in Hz across sample
  rates (was a fixed pole whose corner drifted up with Fs, thinning low end at high
  rates); evaluated at init, off the RT thread.
- New ToneStackModel cases .mesa and .soldano (Faust tonestacks-library values).
- GrayNoise output clamped to [-1, 1] (Int32.min edge).
This commit is contained in:
2026-08-03 15:57:54 -07:00
parent ea0aa84ca7
commit 77580ee98e
7 changed files with 135 additions and 11 deletions
+28 -1
View File
@@ -727,11 +727,38 @@ struct GrayNoiseTests {
}
@Test func floatValueInValidRange() {
let noise: GrayNoise.Audio = GrayNoise.Audio()
// Seeded so the suite is deterministic (an unseeded instance previously flaked when the
// counter reached Int32.min, whose scaled magnitude is just over 1 — now clamped).
let noise: GrayNoise.Audio = GrayNoise.Audio(seed: 7)
let v: Double = noise.floatValue(graph: graph)
#expect(v >= -1.0 && v <= 1.0)
}
@Test func clampedScaleBoundsExtremes() {
// Deterministic boundary check of the scale+clamp math (the RNG walk realistically never
// visits Int32.min, so test it directly).
#expect(grayNoiseClampedScale(Int32.min) == -1.0)
#expect(grayNoiseClampedScale(Int32.max) == 1.0)
#expect(grayNoiseClampedScale(0) == 0.0)
// Documents why the clamp is needed: unclamped, Int32.min scales below -1.
#expect(Double(Int32.min) * (1.0 / Double(Int32.max)) < -1.0)
}
@Test func boundedAcrossManySeeds() {
// Broad deterministic sweep guarding the [-1, 1] contract (regression net for the
// Int32.min sign-bit-flip edge that the per-sample clamp fixes).
for seed: UInt64 in 1...64 {
let noise: GrayNoise.Audio = GrayNoise.Audio(seed: seed)
for _ in 0..<8 {
let samples: [Double] = noise.calculatedSamples(graph: graph, count: blockSize)[0]
for s: Double in samples.prefix(blockSize) {
#expect(s >= -1.0 && s <= 1.0, "seed \(seed) produced out-of-range \(s)")
}
advanceBlock(engine)
}
}
}
@Test func outputIsBitwiseQuantized() {
// Every sample × Int32.max should be exactly representable as an integer.
let noise: GrayNoise.Audio = GrayNoise.Audio(seed: 99)