From 96e6166e62f289866d51eb06bb14f5ea6bac57a8 Mon Sep 17 00:00:00 2001 From: Aqua Date: Fri, 13 Nov 2026 19:28:47 +0000 Subject: [PATCH] smoo_from: back to the plain step form; the comment states the mechanism (starting at the input), not a rounding the form never fixed Soul s2 smoo-step-unfounded: from the input both forms hold a constant control to the bit, from 0 both stall 1e-5..5e-5 short of it; the old form passes the alias test. The rewrite re-pinned every Faust id for nothing. Co-Authored-By: Claude Sonnet 5.5 --- src/AquaSynth.Core/FaustExport.cs | 7 ++++--- tools/aqua-feel/lowered-dings/glass-chime.dsp | 2 +- tools/aqua-feel/lowered-dings/muted-pluck.dsp | 2 +- tools/aqua-feel/lowered-dings/soft-triangle.dsp | 2 +- tools/aqua-feel/lowered-dings/warm-bell.dsp | 2 +- 5 files changed, 8 insertions(+), 7 deletions(-) diff --git a/src/AquaSynth.Core/FaustExport.cs b/src/AquaSynth.Core/FaustExport.cs index b1384c3..51ae72a 100644 --- a/src/AquaSynth.Core/FaustExport.cs +++ b/src/AquaSynth.Core/FaustExport.cs @@ -49,9 +49,10 @@ public static partial class FaustEmitter // and the first ~100 ms of every render were that climb (the level rose 40 dB over the first 100 ms of an isolated vowel, and // the bandwidths fell from ~300 Hz to 90). smoo_from starts at its input and smooths from there. smoo_init is si.smoo's own // pole (1 - 44.1 / SR, a 22.7 ms time constant), so live control moves exactly as fast as before; only the start differs. - // The step is written prev + (x - prev) * (1 - pole), not prev * pole + x * (1 - pole): a control that never moves then - // stays at its input to the bit, where the other form rounds away from it by up to ~4e-5. - source.AppendLine("smoo_from(pole, x) = loop ~ _ with { loop(prev) = select2(1 - 1', prev + (x - prev) * (1.0 - pole), x); };"); + // Started at its input a constant control holds there to the bit; started at 0 (si.smoo, si.smooth) it stalls 1e-5 to 5e-5 short of it, + // in either way of writing the step. The source's pitch-ratio smoother starts at its input for that reason: from 0 the 2744 Hz alias + // source ran 0.12 Hz flat and leaked its harmonics into the alias measurement. + source.AppendLine("smoo_from(pole, x) = loop ~ _ with { loop(prev) = select2(1 - 1', prev * pole + x * (1.0 - pole), x); };"); source.AppendLine("smoo_init(x) = smoo_from(1.0 - 44.1 / ma.SR, x);"); source.AppendLine("seg_smooth(t,t0,d,a,b) = a + (b - a) * smooth01((t - t0) / max(0.0001, d));"); source.AppendLine("seg_exp(t,t0,d,a,b) = exp(log(max(0.00001, a)) + (log(max(0.00001, b)) - log(max(0.00001, a))) * clip01((t - t0) / max(0.0001, d)));"); diff --git a/tools/aqua-feel/lowered-dings/glass-chime.dsp b/tools/aqua-feel/lowered-dings/glass-chime.dsp index 2bc9759..e77b4bd 100644 --- a/tools/aqua-feel/lowered-dings/glass-chime.dsp +++ b/tools/aqua-feel/lowered-dings/glass-chime.dsp @@ -16,7 +16,7 @@ seg(t,t0,d,a,b) = a + (b - a) * clip01((t - t0) / max(0.0001, d)); bez(t,a,b,c,d) = (1.0 - t) * (1.0 - t) * (1.0 - t) * a + 3.0 * (1.0 - t) * (1.0 - t) * t * b + 3.0 * (1.0 - t) * t * t * c + t * t * t * d; seg_bez(t,t0,d,a,b,c,e) = bez(clip01((t - t0) / max(0.0001, d)), a, b, c, e); smooth01(x) = clip01(x) * clip01(x) * (3.0 - 2.0 * clip01(x)); -smoo_from(pole, x) = loop ~ _ with { loop(prev) = select2(1 - 1', prev + (x - prev) * (1.0 - pole), x); }; +smoo_from(pole, x) = loop ~ _ with { loop(prev) = select2(1 - 1', prev * pole + x * (1.0 - pole), x); }; smoo_init(x) = smoo_from(1.0 - 44.1 / ma.SR, x); seg_smooth(t,t0,d,a,b) = a + (b - a) * smooth01((t - t0) / max(0.0001, d)); seg_exp(t,t0,d,a,b) = exp(log(max(0.00001, a)) + (log(max(0.00001, b)) - log(max(0.00001, a))) * clip01((t - t0) / max(0.0001, d))); diff --git a/tools/aqua-feel/lowered-dings/muted-pluck.dsp b/tools/aqua-feel/lowered-dings/muted-pluck.dsp index eab1e5f..c1205aa 100644 --- a/tools/aqua-feel/lowered-dings/muted-pluck.dsp +++ b/tools/aqua-feel/lowered-dings/muted-pluck.dsp @@ -16,7 +16,7 @@ seg(t,t0,d,a,b) = a + (b - a) * clip01((t - t0) / max(0.0001, d)); bez(t,a,b,c,d) = (1.0 - t) * (1.0 - t) * (1.0 - t) * a + 3.0 * (1.0 - t) * (1.0 - t) * t * b + 3.0 * (1.0 - t) * t * t * c + t * t * t * d; seg_bez(t,t0,d,a,b,c,e) = bez(clip01((t - t0) / max(0.0001, d)), a, b, c, e); smooth01(x) = clip01(x) * clip01(x) * (3.0 - 2.0 * clip01(x)); -smoo_from(pole, x) = loop ~ _ with { loop(prev) = select2(1 - 1', prev + (x - prev) * (1.0 - pole), x); }; +smoo_from(pole, x) = loop ~ _ with { loop(prev) = select2(1 - 1', prev * pole + x * (1.0 - pole), x); }; smoo_init(x) = smoo_from(1.0 - 44.1 / ma.SR, x); seg_smooth(t,t0,d,a,b) = a + (b - a) * smooth01((t - t0) / max(0.0001, d)); seg_exp(t,t0,d,a,b) = exp(log(max(0.00001, a)) + (log(max(0.00001, b)) - log(max(0.00001, a))) * clip01((t - t0) / max(0.0001, d))); diff --git a/tools/aqua-feel/lowered-dings/soft-triangle.dsp b/tools/aqua-feel/lowered-dings/soft-triangle.dsp index 7ec81e1..9b82afc 100644 --- a/tools/aqua-feel/lowered-dings/soft-triangle.dsp +++ b/tools/aqua-feel/lowered-dings/soft-triangle.dsp @@ -16,7 +16,7 @@ seg(t,t0,d,a,b) = a + (b - a) * clip01((t - t0) / max(0.0001, d)); bez(t,a,b,c,d) = (1.0 - t) * (1.0 - t) * (1.0 - t) * a + 3.0 * (1.0 - t) * (1.0 - t) * t * b + 3.0 * (1.0 - t) * t * t * c + t * t * t * d; seg_bez(t,t0,d,a,b,c,e) = bez(clip01((t - t0) / max(0.0001, d)), a, b, c, e); smooth01(x) = clip01(x) * clip01(x) * (3.0 - 2.0 * clip01(x)); -smoo_from(pole, x) = loop ~ _ with { loop(prev) = select2(1 - 1', prev + (x - prev) * (1.0 - pole), x); }; +smoo_from(pole, x) = loop ~ _ with { loop(prev) = select2(1 - 1', prev * pole + x * (1.0 - pole), x); }; smoo_init(x) = smoo_from(1.0 - 44.1 / ma.SR, x); seg_smooth(t,t0,d,a,b) = a + (b - a) * smooth01((t - t0) / max(0.0001, d)); seg_exp(t,t0,d,a,b) = exp(log(max(0.00001, a)) + (log(max(0.00001, b)) - log(max(0.00001, a))) * clip01((t - t0) / max(0.0001, d))); diff --git a/tools/aqua-feel/lowered-dings/warm-bell.dsp b/tools/aqua-feel/lowered-dings/warm-bell.dsp index bcb7f83..8acf9bd 100644 --- a/tools/aqua-feel/lowered-dings/warm-bell.dsp +++ b/tools/aqua-feel/lowered-dings/warm-bell.dsp @@ -16,7 +16,7 @@ seg(t,t0,d,a,b) = a + (b - a) * clip01((t - t0) / max(0.0001, d)); bez(t,a,b,c,d) = (1.0 - t) * (1.0 - t) * (1.0 - t) * a + 3.0 * (1.0 - t) * (1.0 - t) * t * b + 3.0 * (1.0 - t) * t * t * c + t * t * t * d; seg_bez(t,t0,d,a,b,c,e) = bez(clip01((t - t0) / max(0.0001, d)), a, b, c, e); smooth01(x) = clip01(x) * clip01(x) * (3.0 - 2.0 * clip01(x)); -smoo_from(pole, x) = loop ~ _ with { loop(prev) = select2(1 - 1', prev + (x - prev) * (1.0 - pole), x); }; +smoo_from(pole, x) = loop ~ _ with { loop(prev) = select2(1 - 1', prev * pole + x * (1.0 - pole), x); }; smoo_init(x) = smoo_from(1.0 - 44.1 / ma.SR, x); seg_smooth(t,t0,d,a,b) = a + (b - a) * smooth01((t - t0) / max(0.0001, d)); seg_exp(t,t0,d,a,b) = exp(log(max(0.00001, a)) + (log(max(0.00001, b)) - log(max(0.00001, a))) * clip01((t - t0) / max(0.0001, d)));