Map Zyn PAD filter envelopes

This commit is contained in:
Meta Vens 2026-05-15 13:24:22 +01:00
commit 5fdb0037ee
9 changed files with 130 additions and 11 deletions

View file

@ -61,7 +61,8 @@ public static class FaustEmitter
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)));");
source.AppendLine("seg_curve(c,t,t0,d,a,b) = select2(c < 0.5, seg_exp(t,t0,d,a,b), seg(t,t0,d,a,b));");
source.AppendLine("rl_release_start(r1,r2,r3,g) = max(g, r1 + r2 + r3);");
source.AppendLine("rl4_env(r1,l1,c1,r2,l2,c2,r3,l3,c3,r4,l4,c4,g) = select2(age < r1, select2(age < r1 + r2, select2(age < r1 + r2 + r3, select2(age < rl_release_start(r1,r2,r3,g), select2(age < rl_release_start(r1,r2,r3,g) + r4, l4, seg_curve(c4, age, rl_release_start(r1,r2,r3,g), r4, l3, l4)), l3), seg_curve(c3, age, r1 + r2, r3, l2, l3)), seg_curve(c2, age, r1, r2, l1, l2)), seg_curve(c1, age, 0, r1, 0, l1));");
source.AppendLine("rl4_env_from(s0,r1,l1,c1,r2,l2,c2,r3,l3,c3,r4,l4,c4,g) = select2(age < r1, select2(age < r1 + r2, select2(age < r1 + r2 + r3, select2(age < rl_release_start(r1,r2,r3,g), select2(age < rl_release_start(r1,r2,r3,g) + r4, l4, seg_curve(c4, age, rl_release_start(r1,r2,r3,g), r4, l3, l4)), l3), seg_curve(c3, age, r1 + r2, r3, l2, l3)), seg_curve(c2, age, r1, r2, l1, l2)), seg_curve(c1, age, 0, r1, s0, l1));");
source.AppendLine("rl4_env(r1,l1,c1,r2,l2,c2,r3,l3,c3,r4,l4,c4,g) = rl4_env_from(0.0,r1,l1,c1,r2,l2,c2,r3,l3,c3,r4,l4,c4,g);");
source.AppendLine("lfo_sin(hz, phase) = sin(2.0 * ma.PI * (age * hz + phase));");
source.AppendLine("lfo_tri(hz, phase) = 1.0 - 4.0 * abs((age * hz + phase - floor(age * hz + phase)) - 0.5);");
source.AppendLine("lfo_sq(hz, phase) = select2((age * hz + phase - floor(age * hz + phase)) < 0.5, -1.0, 1.0);");
@ -220,7 +221,10 @@ public static class FaustEmitter
var driveExpression = $"clip01({parameters.Expression(OwnerField(ownerPath, "color/drive"), voice.Color.Drive)} + patch_mod_drive + {drive})";
var foldExpression = $"clip01({parameters.Expression(OwnerField(ownerPath, "color/fold"), voice.Color.Fold)} + patch_mod_fold + {fold})";
var formantMix = $"clip01({parameters.Expression(OwnerField(ownerPath, "color/formant_mix"), voice.Color.FormantMix)} + patch_mod_formant_mix + {formant})";
var lpf = $"clip01({parameters.Expression(OwnerField(ownerPath, "filter/lpf"), voice.Filter.LowPass)} * (1.0 + {parameters.Expression(OwnerField(ownerPath, "filter/lpf_ramp"), voice.Filter.LowPassRamp)} * age * 1.8) + patch_mod_lpf + {lpfMod})";
var lpfEnvelope = voice.Filter.LowPassEnvelope is { } filterEnvelope
? $" + {RateLevelEnvelopeExpression(filterEnvelope, noteGate)}"
: "";
var lpf = $"clip01({parameters.Expression(OwnerField(ownerPath, "filter/lpf"), voice.Filter.LowPass)} * (1.0 + {parameters.Expression(OwnerField(ownerPath, "filter/lpf_ramp"), voice.Filter.LowPassRamp)} * age * 1.8){lpfEnvelope} + patch_mod_lpf + {lpfMod})";
var hpf = $"clip01({parameters.Expression(OwnerField(ownerPath, "filter/hpf"), voice.Filter.HighPass)} * (1.0 + {parameters.Expression(OwnerField(ownerPath, "filter/hpf_ramp"), voice.Filter.HighPassRamp)} * age * 2.0) + patch_mod_hpf + {hpfMod})";
var hasResonance = voice.Filter.LowPassResonance > 0 || parameters.IsBound(OwnerField(ownerPath, "filter/resonance"));
var resonance = parameters.Expression(OwnerField(ownerPath, "filter/resonance"), voice.Filter.LowPassResonance);
@ -317,7 +321,9 @@ public static class FaustEmitter
}
private static string RateLevelEnvelopeExpression(RateLevelEnvelope envelope, string gate) =>
$"rl4_env({F(envelope.Rate1Seconds)}, {F(envelope.Level1)}, {Curve(envelope.Curve1)}, {F(envelope.Rate2Seconds)}, {F(envelope.Level2)}, {Curve(envelope.Curve2)}, {F(envelope.Rate3Seconds)}, {F(envelope.Level3)}, {Curve(envelope.Curve3)}, {F(envelope.Rate4Seconds)}, {F(envelope.Level4)}, {Curve(envelope.Curve4)}, {gate})";
envelope.StartLevel == 0
? $"rl4_env({F(envelope.Rate1Seconds)}, {F(envelope.Level1)}, {Curve(envelope.Curve1)}, {F(envelope.Rate2Seconds)}, {F(envelope.Level2)}, {Curve(envelope.Curve2)}, {F(envelope.Rate3Seconds)}, {F(envelope.Level3)}, {Curve(envelope.Curve3)}, {F(envelope.Rate4Seconds)}, {F(envelope.Level4)}, {Curve(envelope.Curve4)}, {gate})"
: $"rl4_env_from({F(envelope.StartLevel)}, {F(envelope.Rate1Seconds)}, {F(envelope.Level1)}, {Curve(envelope.Curve1)}, {F(envelope.Rate2Seconds)}, {F(envelope.Level2)}, {Curve(envelope.Curve2)}, {F(envelope.Rate3Seconds)}, {F(envelope.Level3)}, {Curve(envelope.Curve3)}, {F(envelope.Rate4Seconds)}, {F(envelope.Level4)}, {Curve(envelope.Curve4)}, {gate})";
private static string Curve(RateLevelCurve curve) =>
curve == RateLevelCurve.Exponential ? "1" : "0";

View file

@ -58,7 +58,8 @@ public sealed record RateLevelEnvelope(
RateLevelCurve Curve1 = RateLevelCurve.Linear,
RateLevelCurve Curve2 = RateLevelCurve.Linear,
RateLevelCurve Curve3 = RateLevelCurve.Linear,
RateLevelCurve Curve4 = RateLevelCurve.Linear);
RateLevelCurve Curve4 = RateLevelCurve.Linear,
float StartLevel = 0);
public enum NoteSource
{
@ -107,7 +108,8 @@ public sealed record Filter(
float LowPassResonance = 0,
int LowPassOrder = 1,
float HighPass = 0,
float HighPassRamp = 0);
float HighPassRamp = 0,
RateLevelEnvelope? LowPassEnvelope = null);
public sealed record Phaser(float OffsetSeconds = 0, float RampSecondsPerSecond = 0);

View file

@ -443,7 +443,8 @@ public static class PatchScript
GetBoundFloat(fields, line, 0, OwnerField(ownerPath, "filter/resonance"), "resonance", "res"),
GetBoundInt(fields, line, 1, OwnerField(ownerPath, "filter/lpf_order"), "lpf_order", "lpfo"),
GetBoundFloat(fields, line, 0, OwnerField(ownerPath, "filter/hpf"), "hpf", "h"),
GetBoundFloat(fields, line, 0, OwnerField(ownerPath, "filter/hpf_ramp"), "hpf_ramp", "hr")),
GetBoundFloat(fields, line, 0, OwnerField(ownerPath, "filter/hpf_ramp"), "hpf_ramp", "hr"),
ParseFilterRateLevelEnvelope(fields, line, ownerPath)),
Phaser = new Phaser(
GetBoundFloat(fields, line, 0, OwnerField(ownerPath, "phaser/offset"), "phaser", "ph"),
GetBoundFloat(fields, line, 0, OwnerField(ownerPath, "phaser/ramp"), "phaser_ramp", "phr")),
@ -1020,7 +1021,10 @@ public static class PatchScript
Math.Max(0, rates[1]), Math.Clamp(levels[1], 0, 4f),
Math.Max(0, rates[2]), Math.Clamp(levels[2], 0, 4f),
Math.Max(0, rates[3]), Math.Clamp(levels[3], 0, 4f),
curves[0], curves[1], curves[2], curves[3]);
curves[0], curves[1], curves[2], curves[3],
TryGetAny(fields, ["start_level", "start"], out var startText)
? Math.Clamp(ParseFloat(startText, line), 0, 4f)
: 0);
var defaultGate = Math.Max(envelope.Rate1Seconds + envelope.Rate2Seconds + envelope.Rate3Seconds, 0.02f);
return new ParsedEnvelope(
new Envelope(envelope.Rate1Seconds, envelope.Rate2Seconds + envelope.Rate3Seconds, envelope.Level3, envelope.Rate4Seconds),
@ -1028,6 +1032,39 @@ public static class PatchScript
envelope);
}
private RateLevelEnvelope? ParseFilterRateLevelEnvelope(IReadOnlyDictionary<string, string> fields, int line, string ownerPath)
{
if (!TryGetAny(fields, ["lpf_env", "filter_env"], out var env) || env is not ("rl" or "ratelevel"))
{
return null;
}
var rates = ParseFloatList(Required(fields, "lpf_rates", line), line, "lpf_rates");
var levels = ParseFloatList(Required(fields, "lpf_levels", line), line, "lpf_levels");
if (rates.Count != 4 || levels.Count != 4)
{
throw new PatchScriptException(line, "filter rate/level envelope needs four rates and four levels");
}
var curves = TryGetAny(fields, ["lpf_curves", "lpf_curve"], out var curveText)
? ParseCurveList(curveText, line)
: [RateLevelCurve.Linear, RateLevelCurve.Linear, RateLevelCurve.Linear, RateLevelCurve.Linear];
if (curves.Count != 4)
{
throw new PatchScriptException(line, "filter rate/level envelope needs four curves");
}
return new RateLevelEnvelope(
Math.Max(0, rates[0]), Math.Clamp(levels[0], -1, 1),
Math.Max(0, rates[1]), Math.Clamp(levels[1], -1, 1),
Math.Max(0, rates[2]), Math.Clamp(levels[2], -1, 1),
Math.Max(0, rates[3]), Math.Clamp(levels[3], -1, 1),
curves[0], curves[1], curves[2], curves[3],
TryGetAny(fields, ["lpf_start", "filter_start"], out var startText)
? Math.Clamp(ParseFloat(startText, line), -1, 1)
: 0);
}
private static IReadOnlyList<RateLevelCurve> ParseCurveList(string value, int line)
{
var parts = value.Split(',', StringSplitOptions.RemoveEmptyEntries | StringSplitOptions.TrimEntries);

View file

@ -262,6 +262,7 @@ public static class ZynInstrumentReader
var filter = pad.Element("FILTER_PARAMETERS");
var lowPass = ZynPadLowPass(filter);
var lowPassOrder = ZynPadLowPassOrder(filter);
var lowPassEnvelope = ZynPadLowPassEnvelope(filter, lowPass);
var safeName = includeKitSuffix ? $"{safeBaseName}_{kitId}" : safeBaseName;
var partialText = string.Join(",", harmonics.Select(partial => $"{F(partial.Ratio)}:{F(partial.Gain)}"));
@ -281,12 +282,19 @@ public static class ZynInstrumentReader
matched.Add(new($"{featurePrefix}filter_lpf", F(lowPass), "Mapped static Zyn PAD global low-pass frequency into Aquarium layer filtering."));
matched.Add(new($"{featurePrefix}filter_lpf_order", lowPassOrder.ToString(CultureInfo.InvariantCulture), "Mapped Zyn analog LP1/LP2 and stage count into Aquarium low-pass order."));
}
if (filter is not null)
if (lowPassEnvelope is not null)
{
missing.Add(new($"{featurePrefix}filter_modulation", "present", "Filter envelope/LFO lowering remains separate pressure."));
matched.Add(new($"{featurePrefix}filter_lpf_envelope", "ratelevel", "Mapped Zyn PAD filter envelope octave offsets into Aquarium low-pass cutoff motion."));
}
if (filter?.Element("FILTER_LFO") is { } lfo && IntParam(lfo, "intensity", 0) != 0)
{
missing.Add(new($"{featurePrefix}filter_lfo", "present", "Filter LFO lowering remains separate pressure."));
}
script.AppendLine($"layer name={safeName} engine=pad gain={F(layerGain)} lpf={F(lowPass)} lpf_order={lowPassOrder} env=rl rates={F(attack)},{F(decay)},1,{F(release)} levels=1,1,1,0 curves=lin,lin,lin,lin gate=1.5");
var filterEnvelopeText = lowPassEnvelope is null
? ""
: $" lpf_env=rl lpf_start={F(lowPassEnvelope.StartLevel)} lpf_rates={F(lowPassEnvelope.Rate1Seconds)},{F(lowPassEnvelope.Rate2Seconds)},{F(lowPassEnvelope.Rate3Seconds)},{F(lowPassEnvelope.Rate4Seconds)} lpf_levels={F(lowPassEnvelope.Level1)},{F(lowPassEnvelope.Level2)},{F(lowPassEnvelope.Level3)},{F(lowPassEnvelope.Level4)} lpf_curves=lin,lin,lin,lin";
script.AppendLine($"layer name={safeName} engine=pad gain={F(layerGain)} lpf={F(lowPass)} lpf_order={lowPassOrder}{filterEnvelopeText} env=rl rates={F(attack)},{F(decay)},1,{F(release)} levels=1,1,1,0 curves=lin,lin,lin,lin gate=1.5");
script.AppendLine($"spectrum layer={safeName} root={F(tableRootFrequencyHz)} freq={F(noteFrequencyHz)} spread=0 zyn_mode={mode} zyn_bandwidth={bandwidth} zyn_bwscale={bandwidthScale} zyn_profile={profile} zyn_position={position} partials={partialText}");
}
@ -853,6 +861,37 @@ public static class ZynInstrumentReader
return Math.Clamp(poles * (DescendantIntParam(filter, "stages", 0) + 1), 1, 12);
}
private static RateLevelEnvelope? ZynPadLowPassEnvelope(XElement? filter, float baseLowPass)
{
var envelope = filter?.Element("FILTER_ENVELOPE");
if (envelope is null || baseLowPass >= 1)
{
return null;
}
static float OctaveOffset(int value) => (value - 64.0f) / 64.0f * 6.0f;
float LevelOffset(int value) => Math.Clamp(baseLowPass * MathF.Pow(2.0f, OctaveOffset(value)) - baseLowPass, -1f, 1f);
var start = LevelOffset(IntParam(envelope, "A_val", 64));
var level1 = LevelOffset(IntParam(envelope, "D_val", 64));
var level2 = LevelOffset(IntParam(envelope, "S_val", 64));
var level4 = LevelOffset(IntParam(envelope, "R_val", 64));
if (MathF.Abs(start) < 0.00001f &&
MathF.Abs(level1) < 0.00001f &&
MathF.Abs(level2) < 0.00001f &&
MathF.Abs(level4) < 0.00001f)
{
return null;
}
return new RateLevelEnvelope(
EnvelopeTime(envelope, "A_dt", 0.02f), level1,
EnvelopeTime(envelope, "D_dt", 0.42f), level2,
1.0f, level2,
EnvelopeTime(envelope, "R_dt", 1.2f), level4,
StartLevel: start);
}
private static float ZynPadPlaybackFrequency(XElement? frequency, float playbackFrequencyHz)
{
var detuneCents = ZynDetuneCents(

View file

@ -81,3 +81,4 @@
{"date":"2026-05-15","topic":"zyn-ghost-base-function","lesson":"A direct-harmonic readability gate must not erase source identity. Ghost Ensemble needed power-base OscilGen expansion even without downstream oscillator stages; otherwise it collapsed toward a generic two-partial pad.","evidence":"Ghost Ensemble has base_function=4 with two explicit harmonics. Expanding power-base multi-harmonic sources changed the candidate from two partials to 32 partials and improved score to 0.446977, with log-mel 0.402789."}
{"date":"2026-05-15","topic":"zyn-pad-static-filter","lesson":"Zyn PAD static global filter frequency is audible layer-balance authority, not optional decoration. Read nested FILTER params under FILTER_PARAMETERS and lower old Zyn cutoff values through the exponential FilterParams curve, not a linear freq/127 guess.","evidence":"DoublePadBass kit0 filter freq=12 and kit1 freq=61. Linear mapping gave lpf=0.094488/0.480315 and still sounded like all kazoo. Zyn's curve maps them to lpf=0.003325/0.047225, improving log-mel to 0.334546 and making the generated patch deep-bass-first. Filter envelopes/LFOs and level recovery remain missing pressure."}
{"date":"2026-05-15","topic":"zyn-pad-detune-and-filter-order","lesson":"Zyn PAD note frequency is not just the requested note plus table root; FREQUENCY_PARAMETERS coarse/fine detune are live playback authority, and analog LP2 needs a steeper low-pass than Aquarium's old one-pole default.","evidence":"DoublePadBass has coarse_detune=15360, which Zyn getdetune wraps from octave 15 to -1 octave. Emitting spectrum freq=130.8128 instead of 261.6256 and lpf_order=2 moved DoublePadBass log-mel from 0.334546 after static cutoff mapping to 0.259298; remaining gap is RMS/envelope."}
{"date":"2026-05-15","topic":"zyn-pad-filter-envelope","lesson":"Zyn PAD FILTER_ENVELOPE is audible transient authority. Static cutoff parity can get the tone right while still missing the opening hit; Aquarium needs explicit low-pass cutoff envelopes with nonzero start levels.","evidence":"DoublePadBass sounded tonally right but softer at onset. Mapping Zyn ADSR-filter octave offsets into lpf_env=rl with lpf_start improved log-mel from 0.259298 to 0.241993, envelope distance from 0.631427 to 0.554658, RMS ratio from 0.390177 to 0.456173, and score from 0.370218 to 0.404382."}

View file

@ -86,7 +86,7 @@
"zyn_reference_path": {
"status": "Initial ZynInstrumentReader parses plain XML and gzip-compressed .xiz-shaped XML from project-authored fixtures into ZynInstrument records and ReferencePatch features. First Zyn-style Aquarium rebuilds exist for additive lead, PAD texture, and vocal/formant layer. `ZynInstrumentSurvey` can rank .xiz directories by feature pressure. Named `layer` declarations provide the first Zyn-driven DSL abstraction; additive `harmonics`, PAD `spectrum`, and staged `env=rl` voice envelopes now attach to those layers. Zyn PAD `spectrum` banks can now carry explicit `zyn_mode`, `zyn_bandwidth`, `zyn_bwscale`, `zyn_profile`, and `zyn_position` table-generation fields, and `PadSynthWaveform` lowers those through Zyn-style profile/bandwidth math. The pinned Zyn source now builds as a test-only MSYS2/MinGW oracle through `tools/zyn-reference/build-zyn-reference.ps1`, which patches an ignored artifact source copy, proves `PadNoteTest`, and builds `ZynPadReference`.",
"lesson": "Start Zyn as structural classification, then move into explicit scoped rebuilds. Upstream Zyn presets live in a nested GPL instrument-bank submodule and may be used as test-only parity/pressure feedstock once provenance is recorded. The ZynAddSubFX engine source is pinned as GPL test/development material under `external/zynaddsubfx` at 3ab608c432996ba4d582176572c0b0f82328c825; use it as a parity oracle only, never as Aquarium runtime or NuGet package content. Zyn build fixes belong in `tools/zyn-reference/patches/` and apply to ignored artifact copies, not the clean pinned submodule. The PAD oracle now renders both generated PAD sample tables and note audio through Zyn `PADnoteParameters`/`PADnote`; optional parity artifacts live under `artifacts/parity/zyn-pad-reference` and `artifacts/parity/zyn-pad-fixtures`. The first project-authored PAD comparison proved the harness and showed Aquarium `spectrum` was not a close Zyn PAD emulation. User listening identified Zyn as pure wineglass and Aquarium as angry bees. Cutting unearned air/noise/drive/soft-clip from the rebuild, adding interpolated wavetable reads, and raising Aquarium spectral tables to Zyn's 131072-frame PAD size improved the report. A later pitch/drone pass split PAD table root from playback note frequency: `spectrum root=...` owns table/base frequency and `freq=...` owns the played note. Using Zyn's reported sample basefreq 77.7813 while playing 261.6256, removing gratuitous spread/vibrato, collapsing two same-note PAD voices into one coherent spectral table, and trimming gain improved the report to log-mel 0.35669, envelope 0.347572, RMS ratio 1.001704, centroid ratio 1.004072, score 0.6211. The first PAD fixture survey shows `pad-pure` and the old `pad-texture` render identically through Zyn, so the filter/category XML in `pad-texture` is not live pressure for this oracle path. `pad-harmonic` changes the source table and note output through explicit OSCIL harmonics, making it the next real PAD reference rung. The remaining gap is source-table/profile and envelope semantics, not more decorative patch layers. The report now also emits source-table WAVs for listening. The hardened reader parses the upstream GPL instrument bank at commit c5c912131b31df5fdf372d2f06a25aaf2375837f: 1318/1318 .xiz files; optional tests write a ranked report and render five upstream PAD listening fixtures under ignored artifacts. `RebuildFirstPadAsAquariumScript` now generates first-pass per-preset PAD `.aqua` candidates from the first enabled PAD kit item, OSCIL harmonic magnitudes, oracle-reported table base frequency, basic volume, and simple rate/level envelope scaffolding while reporting missing bandwidth/profile/filter semantics. The worst target is `olivers-100/0032-Drum Kit.xiz`, with 16 enabled kit items, mixed ADD/SUB/PAD engines, 106 envelopes, 25 free envelopes, 73 LFOs, 37 filters, and 3 formant filters. The first rebuilds show Aquarium can sketch small Zyn fixtures with existing voices/macros/formants/noise, and the upstream survey correctly pushed named kit/layer routing first. `layer` owns name, engine tag, optional key range metadata, default gain, and effect-send labels while lowering to ordinary voices. `harmonics` owns authored ratio/gain partial banks under those layers. `spectrum` owns PAD-style root/spread/partial clouds under named layers and generated table base frequency; playback `freq` remains note authority. Staged `env=rl` now applies to voices as well as operators, preserving Note as gate authority and envelope data as level-shape authority. Aquarium still does not claim Zyn ADDsynth phase/bandwidth details, full Zyn PAD harmonic-profile/randomness/pitch-zone behavior, arbitrary free-envelope point curves, or richer formant morphing.",
"next": "Continue Zyn PAD parity from the sampled OscilGen stage-order, multi-kit PAD, Zyn-curve static global-filter, low-pass-order, and PAD frequency-detune paths. Ghost Ensemble now expands its power-base multi-harmonic OscilGen source instead of collapsing into a generic two-partial pad. DoublePadBass now rebuilds both enabled PAD kit items, maps Zyn analog LP2 to `lpf_order=2`, and applies Zyn `getdetune` semantics so `coarse_detune=15360` plays one octave down (`freq=130.8128` instead of `261.6256`). Latest DoublePadBass log-mel is 0.259298; remaining pressure is mostly loudness/envelope recovery, especially filter envelope/LFO behavior. Do not claim Zyn PAD parity until broader OscilGen filtering/waveshaping/adaptive-harmonic behavior and note/global filter envelope/LFO ownership are mapped or deliberately excluded."
"next": "Continue Zyn PAD parity from the sampled OscilGen stage-order, multi-kit PAD, Zyn-curve static global-filter, low-pass-order, PAD frequency-detune, and low-pass filter-envelope paths. Ghost Ensemble now expands its power-base multi-harmonic OscilGen source instead of collapsing into a generic two-partial pad. DoublePadBass now rebuilds both enabled PAD kit items, maps Zyn analog LP2 to `lpf_order=2`, applies Zyn `getdetune` semantics so `coarse_detune=15360` plays one octave down (`freq=130.8128` instead of `261.6256`), and maps Zyn `FILTER_ENVELOPE` into Aquarium `lpf_env=rl` cutoff motion with an explicit start level. Latest DoublePadBass log-mel is 0.241993 and envelope distance is 0.554658; remaining pressure is mostly loudness/RMS and any live filter LFOs. Do not claim Zyn PAD parity until broader OscilGen filtering/waveshaping/adaptive-harmonic behavior and note/global filter envelope/LFO ownership are mapped or deliberately excluded."
},
"note_and_envelope_model": {
"rule": "Notes own frequency, gate duration, and host/MIDI source. Envelopes own ADSR level shape.",

View file

@ -114,6 +114,14 @@ Current user-ear correction:
Faust `fi.lowpass(2, ...)` instead of pretending all low-passes are first
order. Latest DoublePadBass: log-mel `0.259298`, score `0.370218`, centroid
ratio `1.027115`; remaining pressure is loudness/envelope recovery.
- User then heard the tone as right but the Zyn reference hitting harder at the
beginning. The missing authority was Zyn's PAD filter envelope: Aqua had only
the static cutoff, while Zyn adds ADSR-filter octave offsets before the
global filter. Aquarium now has a general low-pass rate/level envelope
surface (`lpf_env=rl`, `lpf_start`, `lpf_rates`, `lpf_levels`) and the Zyn
importer maps `FILTER_ENVELOPE` into it. Latest DoublePadBass after this
pass: log-mel `0.241993`, envelope distance `0.554658`, RMS ratio `0.456173`,
score `0.404382`.
Completed this slice:

View file

@ -168,6 +168,19 @@ next_agent_start_here:
- "dotnet test AquariumSynthCSharp.slnx --no-restore"
completed_slices:
- date: 2026-05-15
summary: >
Added a general low-pass rate/level envelope surface and mapped Zyn PAD
`FILTER_ENVELOPE` into it after user listening identified that
DoublePadBass had the right tone but not Zyn's harder opening hit.
`RateLevelEnvelope` now carries an optional start level, Faust emits
`rl4_env_from`, and voices can specify `lpf_env=rl` with `lpf_start`,
`lpf_rates`, `lpf_levels`, and optional `lpf_curves`. The Zyn importer
converts ADSR-filter envelope values into cutoff offsets from the static
Zyn cutoff, preserving the immediate open-filter transient. DoublePadBass
improved from log-mel `0.259298` / envelope distance `0.631427` to
`0.241993` / `0.554658`; remaining pressure is mostly level/RMS.
verification: "dotnet test AquariumSynthCSharp.slnx --no-restore: 104 passed"
- date: 2026-05-15
summary: >
Mapped two missing Zyn PAD authorities exposed by DoublePadBass listening:

View file

@ -666,6 +666,19 @@ public sealed class PatchScriptTests
Assert.Contains("fi.lowpass(2, max(20.0,", export.Source);
}
[Fact]
public void VoiceLowPassRateLevelEnvelopeParsesAndExports()
{
var patch = PatchScript.Parse("v w=saw f=80 lpf=.1 lpf_env=rl lpf_start=.4 lpf_rates=.1,.2,.3,.4 lpf_levels=.3,.2,0,0 lpf_curves=lin,exp,lin,lin");
var export = FaustEmitter.Emit(patch);
var envelope = patch.Voices[0].Filter.LowPassEnvelope;
Assert.NotNull(envelope);
Assert.Equal(.4f, envelope.StartLevel, 5);
Assert.Equal(.3f, envelope.Level1, 5);
Assert.Contains("rl4_env_from(0.4", export.Source);
}
[Fact]
public void VoiceEnvelopeUsesStandardAdsrAndNoteGate()
{