Map Zyn state variable PAD filters

This commit is contained in:
Meta Vens 2026-05-16 10:14:37 +01:00
commit eb27b49f7a
6 changed files with 122 additions and 25 deletions

View file

@ -90,13 +90,15 @@ Current upstream bank coverage:
- Layered instruments: `63`
- Handled with parity-backed or native AquaSynth coverage: PAD layers, named
kit layers, PAD table modes/bandwidth, PAD source-table extraction for the
implemented OscilGen subset, analog PAD LP/HP cutoff/order/Q/envelopes, and
staged non-free envelopes.
implemented OscilGen subset, analog and state-variable PAD LP/HP
cutoff/order/Q/envelopes, and staged non-free envelopes.
- Counted but not translated: ADD, SUB, mixed-engine kits, free envelopes,
active LFO routing, formant filters/motion, and effects.
- Unknown PAD filter pressure: non-analog or unimplemented PAD global filter
categories/types such as `cat=1 type=0`, `cat=2 type=0`, `cat=2 type=2`,
`cat=0 type=4`, `cat=0 type=6`, and smaller buckets.
- Unknown PAD filter pressure: formant filters, state-variable band/notch, and
other unimplemented PAD global filter categories/types such as
`cat=1 type=0`, `cat=2 type=2`, `cat=0 type=4`, `cat=0 type=6`, and
smaller buckets. State-variable LP/HP (`cat=2 type=0/1`) now lower through
AquaSynth's existing cutoff/order/Q authority.
- Unknown PAD OscilGen pressure: unimplemented source filter types
`10`, `12`, `11`, `4`, `5`, `3`, and `8`; unimplemented waveshapers
`2`, `14`, `5`, `6`, `3`, `13`, `8`, and `9`.

View file

@ -369,13 +369,13 @@ public static class ZynInstrumentReader
if (lowPass < 1)
{
matched.Add(new($"{featurePrefix}filter_lpf", F(lowPass), "Mapped static Zyn PAD global low-pass frequency into AquaSynth layer filtering."));
matched.Add(new($"{featurePrefix}filter_lpf_q", F(lowPassQ), "Mapped Zyn analog low-pass Q into AquaSynth filter damping."));
matched.Add(new($"{featurePrefix}filter_lpf_order", lowPassOrder.ToString(CultureInfo.InvariantCulture), "Mapped Zyn analog LP1/LP2 and stage count into AquaSynth low-pass order."));
matched.Add(new($"{featurePrefix}filter_lpf_q", F(lowPassQ), "Mapped Zyn low-pass Q into AquaSynth filter damping."));
matched.Add(new($"{featurePrefix}filter_lpf_order", lowPassOrder.ToString(CultureInfo.InvariantCulture), "Mapped Zyn low-pass family and stage count into AquaSynth low-pass order."));
}
if (highPass > 0)
{
matched.Add(new($"{featurePrefix}filter_hpf", F(highPass), "Mapped static Zyn PAD global high-pass frequency into AquaSynth layer filtering."));
matched.Add(new($"{featurePrefix}filter_hpf_order", highPassOrder.ToString(CultureInfo.InvariantCulture), "Mapped Zyn analog HP1/HP2 and stage count into AquaSynth high-pass order."));
matched.Add(new($"{featurePrefix}filter_hpf_order", highPassOrder.ToString(CultureInfo.InvariantCulture), "Mapped Zyn high-pass family and stage count into AquaSynth high-pass order."));
}
if (lowPassEnvelope is not null)
{
@ -1067,12 +1067,12 @@ public static class ZynInstrumentReader
private static float ZynPadLowPass(XElement? filter, float playbackFrequencyHz)
{
if (filter is null || !TryZynAnalogCutoff(filter, playbackFrequencyHz, out var cutoffHz, out var type))
if (filter is null || !TryZynPadFilterCutoff(filter, playbackFrequencyHz, out var cutoffHz, out var category, out var type))
{
return 1;
}
if (type is not (0 or 2))
if (!IsZynPadLowPassFilter(category, type))
{
return 1;
}
@ -1089,15 +1089,16 @@ public static class ZynInstrumentReader
var category = DescendantIntParam(filter, "category", 0);
var type = DescendantIntParam(filter, "type", 0);
if (category != 0 || type is not (0 or 2))
if (!IsZynPadLowPassFilter(category, type))
{
return 1;
}
var poles = type switch
var poles = (category, type) switch
{
0 => 1,
2 => 2,
(0, 0) => 1,
(0, 2) => 2,
(2, 0) => 1,
_ => 1
};
return Math.Clamp(poles * (DescendantIntParam(filter, "stages", 0) + 1), 1, 12);
@ -1105,12 +1106,12 @@ public static class ZynInstrumentReader
private static float ZynPadHighPass(XElement? filter, float playbackFrequencyHz)
{
if (filter is null || !TryZynAnalogCutoff(filter, playbackFrequencyHz, out var cutoffHz, out var type))
if (filter is null || !TryZynPadFilterCutoff(filter, playbackFrequencyHz, out var cutoffHz, out var category, out var type))
{
return 0;
}
if (type is not (1 or 3))
if (!IsZynPadHighPassFilter(category, type))
{
return 0;
}
@ -1127,12 +1128,18 @@ public static class ZynInstrumentReader
var category = DescendantIntParam(filter, "category", 0);
var type = DescendantIntParam(filter, "type", 0);
if (category != 0 || type is not (1 or 3))
if (!IsZynPadHighPassFilter(category, type))
{
return 1;
}
var poles = type == 1 ? 1 : 2;
var poles = (category, type) switch
{
(0, 1) => 1,
(0, 3) => 2,
(2, 1) => 1,
_ => 1
};
return Math.Clamp(poles * (DescendantIntParam(filter, "stages", 0) + 1), 1, 12);
}
@ -1145,7 +1152,7 @@ public static class ZynInstrumentReader
var category = DescendantIntParam(filter, "category", 0);
var type = DescendantIntParam(filter, "type", 0);
if (category != 0 || type is not (0 or 2))
if (!IsZynPadLowPassFilter(category, type))
{
return 0;
}
@ -1154,11 +1161,11 @@ public static class ZynInstrumentReader
return MathF.Exp(q * q * MathF.Log(1000.0f)) - 0.9f;
}
private static bool TryZynAnalogCutoff(XElement filter, float playbackFrequencyHz, out float cutoffHz, out int type)
private static bool TryZynPadFilterCutoff(XElement filter, float playbackFrequencyHz, out float cutoffHz, out int category, out int type)
{
var category = DescendantIntParam(filter, "category", 0);
category = DescendantIntParam(filter, "category", 0);
type = DescendantIntParam(filter, "type", 0);
if (category != 0)
if (category is not (0 or 2))
{
cutoffHz = 0;
return false;
@ -1170,6 +1177,14 @@ public static class ZynInstrumentReader
return true;
}
private static bool IsZynPadLowPassFilter(int category, int type) =>
(category == 0 && type is 0 or 2) ||
(category == 2 && type == 0);
private static bool IsZynPadHighPassFilter(int category, int type) =>
(category == 0 && type is 1 or 3) ||
(category == 2 && type == 1);
private static RateLevelEnvelope? ZynPadLowPassEnvelope(XElement? filter, float baseLowPass)
{
var envelope = filter?.Element("FILTER_ENVELOPE");
@ -1366,7 +1381,9 @@ public static class ZynInstrumentSurvey
"cat=0 type=0",
"cat=0 type=1",
"cat=0 type=2",
"cat=0 type=3"
"cat=0 type=3",
"cat=2 type=0",
"cat=2 type=1"
};
public static IReadOnlyList<ZynInstrumentSurveyItem> RankDirectory(string root, int take = 25)
@ -1671,7 +1688,7 @@ public static class ZynInstrumentSurvey
HandledPadGlobalFilters.Contains(filterKey) ? ZynCoverageStatus.Handled : ZynCoverageStatus.Unknown,
relativePath,
HandledPadGlobalFilters.Contains(filterKey)
? "Analog LP/HP PAD filters map to AquaSynth cutoff, order, Q, and envelope fields."
? "LP/HP PAD filters map to AquaSynth cutoff, order, Q, and envelope fields."
: "Observed PAD filter category/type is not translated by the current PAD rebuild path.");
foreach (var filterLfo in filter.Elements("FILTER_LFO"))

View file

@ -92,3 +92,4 @@
{"date":"2026-05-16","topic":"pad-syntax-generalization","lesson":"Reference-synth names must not become canonical AquaSynth syntax or public patch-model vocabulary. Importers may translate Zyn controls, and parser aliases may keep old parity artifacts readable, but generated/authored `.aqua` should use AquaSynth-native `pad_*` terms for general spectral-table intent.","evidence":"Zyn PAD parity had produced generated scripts with `zyn_mode`, `zyn_bandwidth`, `zyn_bwscale`, `zyn_profile`, and `zyn_position`, plus public model names like `ZynHarmonicProfile`. The generalization pass changed generated scripts to `pad_mode`, `pad_bandwidth`, `pad_bwscale`, `pad_profile`, and `pad_position`, renamed the public profile/position records and enums to PAD-native names, preserved legacy `zyn_*` parser aliases, and passed `dotnet test AquaSynth.slnx --no-restore` with 108 tests."}
{"date":"2026-05-16","topic":"project-rename-aquasynth","lesson":"The C# synth repo is now AquaSynth and the Rust reference branch is AquaSynth-rs. Keep repo wiring, package metadata, namespaces, solution/project names, env vars, docs, and state aligned to AquaSynth; do not reintroduce AquariumSynthCSharp/AquariumSynth.Dsl names.","evidence":"Renamed solution to AquaSynth.slnx, projects to src/AquaSynth.Dsl and tests/AquaSynth.Dsl.Tests, namespaces/package to AquaSynth.Dsl, package version suffix to 0.1.0-aquasynth.1, DX7 env var to AQUASYNTH_DX7_PYTHON, and origin to https://github.com/GameCult/AquaSynth.git. Verified `dotnet build AquaSynth.slnx --no-restore`, `dotnet test tests\\AquaSynth.Dsl.Tests\\AquaSynth.Dsl.Tests.csproj --no-build -v minimal` with 108 passed, and `dotnet pack src\\AquaSynth.Dsl\\AquaSynth.Dsl.csproj -c Release --no-restore` producing AquaSynth.Dsl.0.1.0-aquasynth.1.nupkg."}
{"date":"2026-05-16","topic":"zyn-coverage-map","lesson":"Zyn coverage must distinguish handled parity-backed behavior, counted pressure, and unknown subtypes. Broad parse success is inventory, not expressivity. The upstream GPL bank currently parses 1318/1318 files and yields 1459 enabled kit items / 63 layered instruments; PAD coverage is strongest, while ADD, SUB, active LFO routing, free envelopes, formant motion, effects, non-analog PAD filters, and several PAD OscilGen filter/waveshaper subtypes remain workout buckets.","evidence":"Added `ZynCoverageStatus`, `ZynCoverageBucket`, `ZynCoverageReport`, `ZynInstrumentSurvey.CoverageDirectory`, and `CoverageMarkdown`; `SurveysUpstreamGplInstrumentBankWhenAvailable` writes `artifacts/parity/zyn-upstream-bank-survey/coverage.md`. Focused ZynInstrumentTests passed 13/13."}
{"date":"2026-05-16","topic":"zyn-pad-state-variable-filter","lesson":"Zyn PAD state-variable low-pass/high-pass filters are not a new Aqua authority. Category 2 type 0/1 maps cleanly onto existing `lpf`/`hpf` cutoff, Q, and order fields because Zyn `SVFilter` exposes low/high outputs and cascades `stages + 1`. Category 2 type 2/3 are band-pass/notch and must remain unknown until AquaSynth has a real band/notch filter owner.","evidence":"Mapped PAD filter `cat=2 type=0/1` in `ZynInstrumentReader`, moved those coverage buckets to handled, and added `RebuildMapsZynStateVariablePadLowPassToAquaFilterAuthority`. Focused ZynInstrumentTests passed 14/14."}

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 AquaSynth 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 AquaSynth 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 AquaSynth `spectrum` was not a close Zyn PAD emulation. User listening identified Zyn as pure wineglass and AquaSynth as angry bees. Cutting unearned air/noise/drive/soft-clip from the rebuild, adding interpolated wavetable reads, and raising AquaSynth 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, a handled/counted/unknown coverage map, and five upstream PAD listening fixtures under ignored artifacts. Coverage currently says PAD is the strongest exercised path, while ADD, SUB, active LFO routing, free envelopes, formant motion, effects, non-analog PAD filters, and several PAD OscilGen filter/waveshaper subtypes remain workout buckets. `RebuildFirstPadAsAquaSynthScript` 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 AquaSynth 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. AquaSynth 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.",
"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 AquaSynth 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 AquaSynth `spectrum` was not a close Zyn PAD emulation. User listening identified Zyn as pure wineglass and AquaSynth as angry bees. Cutting unearned air/noise/drive/soft-clip from the rebuild, adding interpolated wavetable reads, and raising AquaSynth 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, a handled/counted/unknown coverage map, and five upstream PAD listening fixtures under ignored artifacts. Coverage currently says PAD is the strongest exercised path, while ADD, SUB, active LFO routing, free envelopes, formant motion, effects, PAD formant/band/notch filters, and several PAD OscilGen filter/waveshaper subtypes remain workout buckets. Zyn PAD state-variable LP/HP filters now lower through existing AquaSynth cutoff/order/Q fields; state-variable band/notch still need a real filter authority before translation. `RebuildFirstPadAsAquaSynthScript` 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 AquaSynth 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. AquaSynth 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/high-pass order, PAD frequency-detune, low-pass/high-pass filter-envelope, logarithmic Zyn envelope-time, generated Zyn PAD output-calibration, low-pass note tracking, explicit low-pass Q, Q+order cascade, one-based OscilGen oscillator-filter index, base-function-7 selected-table-root, base-function phase modulation, and adaptive-harmonics paths. Ghost Ensemble now expands its power-base multi-harmonic OscilGen source, applies Zyn filter note tracking from `freq_track`, emits `lpf_q` from the Zyn analog filter `q`, and preserves low-pass slope by cascading resonant Faust stages according to `lpf_order`; latest Ghost log-mel is 0.369402, envelope distance is 0.363685, RMS ratio is 1.054875, centroid ratio is 1.006808, and score is 0.57229. DoublePadBass is accepted by ear and latest survey reports log-mel 0.247674, envelope distance 0.208351, RMS ratio 0.888011, score 0.650319. Soft Pad is accepted by ear. Organ Choir now maps kit0 HP2/stage/filter-envelope motion and kit1's selected table root, `base_function_modulation=1`, and `adaptive_harmonics=1`; latest Organ log-mel is 0.471483, envelope distance 0.302978, RMS ratio 0.878, centroid ratio 1.011328, and score 0.541933. Its kit1 PAD table energy now matches the wind-body shape much more closely: 400-800 Hz 0.2713 vs Zyn 0.2780 and 8-16 kHz 0.1471 vs Zyn 0.1355. ZynPadReference has test-only `harmonics` and `selected` modes; selected roots are diagnostic/source-specific, not a global default, because global selected roots regressed accepted DoublePadBass. sin2x remains loud/concentrated after the one-based filter-index fix, so do not claim full Zyn PAD parity until broader OscilGen filtering/waveshaping/adaptive-harmonic behavior and note/global filter LFO ownership are mapped or deliberately excluded."
},
"note_and_envelope_model": {

View file

@ -83,6 +83,7 @@ live_invariants:
- PAD `spectrum` declarations own authored partial clouds under named layers and split table root from playback pitch: `root` is source/base frequency, while `freq` is the note played by the spectral voice. They generate PADsynth-style FFT wavetables with frequency-domain spreading and deterministic random phase, then emit Faust table readers before ordinary voice treatment. Richer PAD table shaping uses neutral `pad_mode`, `pad_bandwidth`, `pad_bwscale`, `pad_profile`, and `pad_position` syntax. The parser may accept older `zyn_*` parity-artifact aliases, but generated/authored `.aqua` should not expose reference-synth names for general DSP intent. Do not pretend this covers every Zyn OscilGen modulation/waveshaping/filter/adaptive-harmonic path yet.
- Zyn OscilGen oscillator filters use one-based harmonic indices: first harmonic is `1`, not `0`. Preserve that index when translating filter types or spectral peaks move to the wrong partial.
- Zyn PAD analog high-pass filters are filter authority too: HP1/HP2 type, stages, and FILTER_ENVELOPE motion lower through `hpf_order` and `hpf_env=rl`, not ad hoc layer gain or brightness compensation.
- Zyn PAD state-variable LP/HP filters (`category=2`, `type=0/1`) are still cutoff/order/Q authority and lower through the existing AquaSynth `lpf`/`hpf` fields. State-variable band/notch (`type=2/3`) remain unknown until a band/notch filter authority earns itself.
- Zyn PAD selected table roots are not a global default in AquaSynth lowering. Keep sample-0 roots unless a source rule earns the selected root; currently OscilGen shift-base sources (`base_function=7`) may use the selected note table root because Organ Choir proved sample-0 roots leave the octave voice misaligned.
- Zyn OscilGen base-function modulation is source-table authority: apply it as phase modulation before base-function sampling, not as later oscillator modulation or filter/EQ compensation.
- Zyn adaptive harmonics remap the prepared oscillator spectrum at the PAD table root frequency before PAD bandwidth/profile spreading. Do not skip it for sources whose wind/body character depends on sparse remapped harmonics.

View file

@ -225,6 +225,51 @@ public sealed class ZynInstrumentTests
Assert.True(octavePartials[4] < 0.001f);
}
[Fact]
public void RebuildMapsZynStateVariablePadLowPassToAquaFilterAuthority()
{
var rebuild = ZynInstrumentReader.RebuildFirstPadAsAquaSynthScript(Encoding.UTF8.GetBytes("""
<?xml version="1.0" encoding="UTF-8"?>
<ZynAddSubFX-data>
<INSTRUMENT>
<INFO><string name="name">SV Low PAD</string></INFO>
<INSTRUMENT_KIT>
<INSTRUMENT_KIT_ITEM id="0">
<par_bool name="enabled" value="yes"/>
<par_bool name="pad_enabled" value="yes"/>
<PAD_SYNTH_PARAMETERS>
<OSCIL>
<HARMONICS>
<HARMONIC id="1"><par name="mag" value="127"/></HARMONIC>
</HARMONICS>
</OSCIL>
<FILTER_PARAMETERS>
<FILTER>
<par name="category" value="2"/>
<par name="type" value="0"/>
<par name="freq" value="48"/>
<par name="q" value="32"/>
<par name="stages" value="2"/>
</FILTER>
</FILTER_PARAMETERS>
</PAD_SYNTH_PARAMETERS>
</INSTRUMENT_KIT_ITEM>
</INSTRUMENT_KIT>
</INSTRUMENT>
</ZynAddSubFX-data>
"""), tableRootFrequencyHz: 77.7813f);
var patch = PatchScript.Parse(rebuild.Script);
var bank = Assert.Single(patch.SpectralBanks);
var voice = bank.Treatment;
Assert.True(voice.Filter.LowPass < 1);
Assert.Equal(3, voice.Filter.LowPassOrder);
Assert.True(voice.Filter.LowPassQ > 0);
Assert.Equal(0, voice.Filter.HighPass);
Assert.Contains(rebuild.MatchedFeatures, feature => feature.Name == "pad_filter_lpf");
Assert.Contains(rebuild.MatchedFeatures, feature => feature.Name == "pad_filter_lpf_order" && feature.Value == "3");
}
[Fact]
public async Task SurveysUpstreamGplInstrumentBankWhenAvailable()
{
@ -338,9 +383,40 @@ public sealed class ZynInstrumentTests
</INSTRUMENT>
</ZynAddSubFX-data>
""");
File.WriteAllText(Path.Combine(dir.FullName, "handled-sv-pad.xiz"), """
<?xml version="1.0" encoding="UTF-8"?>
<ZynAddSubFX-data>
<INSTRUMENT>
<INFO><string name="name">Handled SV PAD</string></INFO>
<INSTRUMENT_KIT>
<INSTRUMENT_KIT_ITEM id="0">
<par_bool name="enabled" value="yes"/>
<par_bool name="pad_enabled" value="yes"/>
<PAD_SYNTH_PARAMETERS>
<OSCIL>
<HARMONICS>
<HARMONIC id="1"><par name="mag" value="127"/></HARMONIC>
</HARMONICS>
</OSCIL>
<FILTER_PARAMETERS>
<FILTER>
<par name="category" value="2"/>
<par name="type" value="0"/>
</FILTER>
</FILTER_PARAMETERS>
</PAD_SYNTH_PARAMETERS>
</INSTRUMENT_KIT_ITEM>
</INSTRUMENT_KIT>
</INSTRUMENT>
</ZynAddSubFX-data>
""");
var report = ZynInstrumentSurvey.CoverageDirectory(dir.FullName);
Assert.Contains(report.Buckets, bucket =>
bucket.Area == "pad.filter" &&
bucket.Key == "cat=2 type=0" &&
bucket.Status == ZynCoverageStatus.Handled);
Assert.Contains(report.UnknownBuckets, bucket =>
bucket.Area == "pad.oscil.filter_type" &&
bucket.Key == "12");