diff --git a/docs/acoustic-graph-proprioception.md b/docs/acoustic-graph-proprioception.md index 18ef009..9988f26 100644 --- a/docs/acoustic-graph-proprioception.md +++ b/docs/acoustic-graph-proprioception.md @@ -226,12 +226,21 @@ flow hidden. The first primitive cut is in place: parser/model records, primitive Faust lowering, tract fixture adaptation, and deterministic `ProbeTimeline` CSV -support. The next implementation pass should harden the primitives: +support. The second cut adds explicit path wave/passivity probes and a +PT/SndKit comparison report: -- make path probes report explicit incoming and outgoing wave variables; -- add passivity/energy checks as first-class timeline samples; -- compare Aqua primitive timelines against PT/SndKit internals for one compact - tract; +- `ProbeTimelineReport` now reports path `incoming_wave`, `outgoing_wave`, + `energy_in`, `energy_out`, and `passivity_ratio`, plus contact resistance. +- Primitive Faust debug probes expose the same path wave and passivity fields + under `/debug/...`. +- `PrimitiveReferenceReport.ComparePinkTrombone` compares primitive geometry, + delay, branch admittance, contact, and radiation fields against local + PT/SndKit fixture controls without adding a native reference dependency to CI. + +The next implementation pass should harden the primitives further: + +- compare per-block Aqua primitive timelines against PT/SndKit internals for one + compact tract render, not just static fixture controls; - add optional VTL/ArtiSynth adapters only as artifact comparators, not default CI dependencies; - keep `mama`, `papa`, and `thrombosis` as downstream witnesses until primitive diff --git a/src/AquaSynth.Core/FaustExport.cs b/src/AquaSynth.Core/FaustExport.cs index 681216b..0db5bcf 100644 --- a/src/AquaSynth.Core/FaustExport.cs +++ b/src/AquaSynth.Core/FaustExport.cs @@ -490,7 +490,11 @@ public static class FaustEmitter var representativeArea = $"{name}_primitive_path_{safePath}_area"; var delay = $"{name}_primitive_path_{safePath}_delay"; var input = $"{name}_primitive_path_{safePath}_input"; + var incoming = $"{name}_primitive_path_{safePath}_incoming_wave"; var wave = $"{name}_primitive_path_{safePath}_wave"; + var energyIn = $"{name}_primitive_path_{safePath}_energy_in"; + var energyOut = $"{name}_primitive_path_{safePath}_energy_out"; + var passivity = $"{name}_primitive_path_{safePath}_passivity_ratio"; var loss = $"clip01({parameters.Expression(OwnerField(pathField, "loss"), path.Loss)})"; source.AppendLine($" {representativeArea} = {ProbeSignal(options, $"/debug/{name}/path/{path.Name}/area", PrimitiveAreaExpression(patch, parameters, area, areaIndex), 0, 8)};"); source.AppendLine($" {delay} = {ProbeSignal(options, $"/debug/{name}/path/{path.Name}/delay", $"({F(area.Shape.LengthMeters)} / max(1.0, {parameters.Expression(OwnerField(pathField, "speed"), path.PropagationSpeedMetersPerSecond)})) * ma.SR", 0, path.MaxDelaySamples)};"); @@ -520,9 +524,17 @@ public static class FaustEmitter .ToList(); var pathInputs = sourceTerms.Concat(contactTerms).Concat(branchTerms).ToList(); source.AppendLine($" {input} = {ProbeSignal(options, $"/debug/{name}/path/{path.Name}/input_flow", pathInputs.Count == 0 ? "0.0" : string.Join(" + ", pathInputs), -4, 4)};"); - source.AppendLine($" {wave} = {ProbeSignal(options, $"/debug/{name}/path/{path.Name}/outgoing_wave", $"({input}) : {PrimitiveDelayExpression(path, path.MaxDelaySamples, delay)} * {loss}", -4, 4)};"); + source.AppendLine($" {incoming} = {ProbeSignal(options, $"/debug/{name}/path/{path.Name}/incoming_wave", input, -4, 4)};"); + source.AppendLine($" {wave} = {ProbeSignal(options, $"/debug/{name}/path/{path.Name}/outgoing_wave", $"({incoming}) : {PrimitiveDelayExpression(path, path.MaxDelaySamples, delay)} * {loss}", -4, 4)};"); + source.AppendLine($" {energyIn} = {ProbeSignal(options, $"/debug/{name}/path/{path.Name}/energy_in", $"{representativeArea} * pow({incoming}, 2.0)", 0, 8)};"); + source.AppendLine($" {energyOut} = {ProbeSignal(options, $"/debug/{name}/path/{path.Name}/energy_out", $"{representativeArea} * pow({wave}, 2.0)", 0, 8)};"); + source.AppendLine($" {passivity} = {ProbeSignal(options, $"/debug/{name}/path/{path.Name}/passivity_ratio", $"{energyOut} / max(0.000001, {energyIn})", 0, 2)};"); keepAlive.Add(input); + keepAlive.Add(incoming); keepAlive.Add(wave); + keepAlive.Add(energyIn); + keepAlive.Add(energyOut); + keepAlive.Add(passivity); foreach (var loadName in network.Radiation) { diff --git a/src/AquaSynth.Core/PrimitiveReferenceReport.cs b/src/AquaSynth.Core/PrimitiveReferenceReport.cs new file mode 100644 index 0000000..6f4a538 --- /dev/null +++ b/src/AquaSynth.Core/PrimitiveReferenceReport.cs @@ -0,0 +1,95 @@ +using System.Globalization; +using System.Text; + +namespace AquaSynth.Dsl; + +public sealed record PrimitiveReferenceSample( + string Reference, + string Primitive, + string Signal, + float Candidate, + float Expected, + float Error); + +public static class PrimitiveReferenceReport +{ + public const string PinkTromboneReference = "pt-sndkit"; + + public static IReadOnlyList ComparePinkTrombone( + SynthPatch patch, + string networkName, + PinkTromboneFixtureControls controls) + { + var network = patch.VocalNetworks.First(network => network.Name.Equals(networkName, StringComparison.OrdinalIgnoreCase)); + var areas = patch.AreaFunctions.ToDictionary(area => area.Name, StringComparer.OrdinalIgnoreCase); + var paths = patch.WaveguidePaths.ToDictionary(path => path.Name, StringComparer.OrdinalIgnoreCase); + var contacts = patch.ConstrictionContacts.ToDictionary(contact => contact.Name, StringComparer.OrdinalIgnoreCase); + var branches = patch.BranchPorts.ToDictionary(branch => branch.Name, StringComparer.OrdinalIgnoreCase); + var radiation = patch.RadiationLoads.ToDictionary(load => load.Name, StringComparer.OrdinalIgnoreCase); + var rows = new List(); + + foreach (var pathName in network.Paths) + { + var path = paths[pathName]; + var area = areas[path.AreaFunction]; + var isNasal = path.Name.Contains("nasal", StringComparison.OrdinalIgnoreCase) || + area.Name.Contains("nasal", StringComparison.OrdinalIgnoreCase); + Add(rows, $"area:{area.Name}", "sections", area.Shape.Sections, isNasal ? 28 : 44); + Add(rows, $"area:{area.Name}", "length_cm", area.Shape.LengthCentimeters, isNasal ? 12 : 17); + Add(rows, $"area:{area.Name}", "reflection_count", area.Shape.ReflectionCoefficients.Count, Math.Max(0, area.Shape.Sections - 1)); + Add(rows, $"path:{path.Name}", "delay_samples_48k", area.Shape.LengthMeters / Math.Max(1, path.PropagationSpeedMetersPerSecond) * 48000, area.Shape.LengthMeters / 343f * 48000); + } + + foreach (var branchName in network.Branches) + { + var branch = branches[branchName]; + Add(rows, $"branch:{branch.Name}", "admittance", Math.Clamp(branch.Opening, 0, 1) * Math.Clamp(branch.Coupling, 0, 1), Math.Clamp(controls.Velum, 0, 1)); + Add(rows, $"branch:{branch.Name}", "junction_position", branch.FromPosition, 17f / 43f); + } + + foreach (var contactName in network.Contacts) + { + var contact = contacts[contactName]; + Add(rows, $"contact:{contact.Name}", "position", contact.Position, controls.ConstrictionIndex / 43f); + Add(rows, $"contact:{contact.Name}", "opening", contact.Opening, Math.Clamp(controls.ConstrictionDiameter / 2.5f, 0, 1)); + Add(rows, $"contact:{contact.Name}", "stored_pressure", contact.StoredPressure, controls.Burst); + } + + foreach (var loadName in network.Radiation) + { + var load = radiation[loadName]; + Add(rows, $"radiation:{load.Name}", "aperture", load.Aperture, Math.Clamp(controls.LipOpening, 0, 1)); + Add(rows, $"radiation:{load.Name}", "reflection", load.Reflection, controls.LipReflection); + } + + return rows; + } + + public static string ToCsv(IReadOnlyList samples) + { + var builder = new StringBuilder(); + builder.AppendLine("reference,primitive,signal,candidate,expected,error"); + foreach (var sample in samples) + { + builder.Append(Escape(sample.Reference)); + builder.Append(','); + builder.Append(Escape(sample.Primitive)); + builder.Append(','); + builder.Append(Escape(sample.Signal)); + builder.Append(','); + builder.Append(sample.Candidate.ToString("0.######", CultureInfo.InvariantCulture)); + builder.Append(','); + builder.Append(sample.Expected.ToString("0.######", CultureInfo.InvariantCulture)); + builder.Append(','); + builder.AppendLine(sample.Error.ToString("0.######", CultureInfo.InvariantCulture)); + } + + return builder.ToString(); + } + + private static void Add(List rows, string primitive, string signal, float candidate, float expected) => + rows.Add(new PrimitiveReferenceSample(PinkTromboneReference, primitive, signal, candidate, expected, candidate - expected)); + + private static string Escape(string value) => + value.Contains(',') || value.Contains('"') ? $"\"{value.Replace("\"", "\"\"", StringComparison.Ordinal)}\"" : value; +} diff --git a/src/AquaSynth.Core/ProbeTimelineReport.cs b/src/AquaSynth.Core/ProbeTimelineReport.cs index 028622b..06daf23 100644 --- a/src/AquaSynth.Core/ProbeTimelineReport.cs +++ b/src/AquaSynth.Core/ProbeTimelineReport.cs @@ -26,9 +26,18 @@ public static class ProbeTimelineReport var area = areas[path.AreaFunction]; var pathArea = area.Shape.Areas.Count == 0 ? 0 : area.Shape.Areas.Average(); var delay = area.Shape.LengthMeters / Math.Max(1, path.PropagationSpeedMetersPerSecond) * 48000; + var incoming = PathIncomingFlow(network, sources, contacts, branches, path.Name); + var outgoing = incoming * Math.Clamp(path.Loss, 0, 1); + var energyIn = pathArea * incoming * incoming; + var energyOut = pathArea * outgoing * outgoing; Add(samples, block, $"path:{path.Name}", "area", pathArea); Add(samples, block, $"path:{path.Name}", "delay_samples", delay); Add(samples, block, $"path:{path.Name}", "loss", path.Loss); + Add(samples, block, $"path:{path.Name}", "incoming_wave", incoming); + Add(samples, block, $"path:{path.Name}", "outgoing_wave", outgoing); + Add(samples, block, $"path:{path.Name}", "energy_in", energyIn); + Add(samples, block, $"path:{path.Name}", "energy_out", energyOut); + Add(samples, block, $"path:{path.Name}", "passivity_ratio", energyIn <= 0.000001f ? 1 : energyOut / energyIn); } foreach (var sourceName in network.Sources) @@ -45,6 +54,7 @@ public static class ProbeTimelineReport var opening = Math.Clamp(contact.Opening, 0, 1); var reservoir = contact.StoredPressure + (1 - opening) * contact.Resistance; Add(samples, block, $"contact:{contact.Name}", "opening", opening); + Add(samples, block, $"contact:{contact.Name}", "resistance", contact.Resistance); Add(samples, block, $"contact:{contact.Name}", "reservoir", reservoir); Add(samples, block, $"contact:{contact.Name}", "released_flow", reservoir * opening * (1 - Math.Min(0.95f, contact.Resistance * 0.5f))); } @@ -93,6 +103,33 @@ public static class ProbeTimelineReport private static void Add(List samples, int block, string primitive, string signal, float value) => samples.Add(new ProbeTimelineSample(block, primitive, signal, value)); + private static float PathIncomingFlow( + VocalNetwork network, + IReadOnlyDictionary sources, + IReadOnlyDictionary contacts, + IReadOnlyDictionary branches, + string pathName) + { + var sourceFlow = network.Sources + .Select(name => sources[name]) + .Where(source => source.Path.Equals(pathName, StringComparison.OrdinalIgnoreCase)) + .Sum(source => MathF.Tanh(source.Pressure * Math.Max(0, source.Opening) * (0.5f + source.Tension) / Math.Max(0.05f, source.Impedance))); + var contactFlow = network.Contacts + .Select(name => contacts[name]) + .Where(contact => contact.Path.Equals(pathName, StringComparison.OrdinalIgnoreCase)) + .Sum(contact => + { + var opening = Math.Clamp(contact.Opening, 0, 1); + var reservoir = contact.StoredPressure + (1 - opening) * contact.Resistance; + return reservoir * opening * (1 - Math.Min(0.95f, contact.Resistance * 0.5f)); + }); + var branchFlow = network.Branches + .Select(name => branches[name]) + .Where(branch => branch.FromPath.Equals(pathName, StringComparison.OrdinalIgnoreCase)) + .Sum(branch => -Math.Clamp(branch.Opening, 0, 1) * Math.Clamp(branch.Coupling, 0, 1) * 0.05f); + return sourceFlow + contactFlow + branchFlow; + } + private static string Escape(string value) => value.Contains(',') || value.Contains('"') ? $"\"{value.Replace("\"", "\"\"", StringComparison.Ordinal)}\"" : value; } diff --git a/state/evidence.jsonl b/state/evidence.jsonl index 1245b29..912296a 100644 --- a/state/evidence.jsonl +++ b/state/evidence.jsonl @@ -227,3 +227,4 @@ {"date":"2026-05-29","area":"acoustic-graph","summary":"Proprioception pass confirmed the Jenga smell: research vocabulary and named graph components outpaced baby-word owner tests. The live cut line is now to stop adding graph-vocal physics until a focused vowel-body witness proves sustained open `a`, `ma`, and `pa` with listening-aligned reports. The likely missing owners are vowel body/radiation color, graph-owned tract motion, continuous source/contact heuristics over the compact graph, and probes that observe the word-level failure instead of only organ internals.","evidence":"docs/acoustic-graph-proprioception.md; docs/acoustic-graph-dsp-audit.md; artifacts/parity/pink-trombone-utterance-logmel/20260529T141822464"} {"date":"2026-05-29","area":"acoustic-graph","summary":"Corrected the proprioception cut line after user pushback: baby words are downstream witnesses, not the architecture owner. The live rebuild direction is primitive collapse plus instrumentation: reduce generated graph-vocal lowering to AreaFunction, WaveguidePath, ScatterJunction, SourcePort, ConstrictionContact, BranchPort, RadiationLoad, and ProbeTimeline; compare primitive/sample-flow behavior against VocalTractLab, ArtiSynth, Story/TubeTalker, Smith/Faust, and PT/SndKit before more utterance golf.","evidence":"docs/acoustic-graph-proprioception.md; docs/acoustic-graph-flow-audit.md; research/physical-voice-modeling/PEOPLE.md; research/physical-voice-modeling/talks/TALKS.md"} {"date":"2026-05-29","area":"primitive-vocal-rebuild","summary":"First teardown cut implemented. PT-shaped tract authoring now adapts into primitive vocal records and no longer emits generated area/contact/injection acoustic banks. The deleted `EnsureTractAcousticNetwork` path makes the old generated graph structurally unable to own default vocal DSP. `VocalNetwork` lowering emits compact primitive Faust locals with delay-library propagation and debug probes, and `ProbeTimelineReport` writes deterministic primitive CSV telemetry before utterance parity. PatchScriptTests pass 84/84, including optional primitive Faust validation when Faust is installed.","evidence":"src/AquaSynth.Core/Model.cs; src/AquaSynth.Core/PatchScript.cs; src/AquaSynth.Core/FaustExport.cs; src/AquaSynth.Core/ProbeTimelineReport.cs; tests/AquaSynth.Dsl.Tests/PatchScriptTests.cs; docs/acoustic-graph-proprioception.md"} +{"date":"2026-05-29","area":"primitive-vocal-telemetry","summary":"Primitive timelines now expose path incoming/outgoing wave variables, area-weighted energy in/out, passivity ratio, and contact resistance. Faust debug probes expose matching path wave/passivity fields. `PrimitiveReferenceReport.ComparePinkTrombone` adds a PT/SndKit-facing static comparison report for area sections/length/reflection count, delay estimate, branch admittance, contact state, and radiation fields. PatchScriptTests pass 86/86.","evidence":"src/AquaSynth.Core/FaustExport.cs; src/AquaSynth.Core/ProbeTimelineReport.cs; src/AquaSynth.Core/PrimitiveReferenceReport.cs; tests/AquaSynth.Dsl.Tests/PatchScriptTests.cs; docs/acoustic-graph-proprioception.md"} diff --git a/state/map.yaml b/state/map.yaml index 14dbb00..5a6b6d0 100644 --- a/state/map.yaml +++ b/state/map.yaml @@ -56,6 +56,7 @@ modules: primitive_vocal_model: src/AquaSynth.Core/Model.cs primitive_vocal_lowering: src/AquaSynth.Core/FaustExport.cs primitive_vocal_timeline: src/AquaSynth.Core/ProbeTimelineReport.cs + primitive_vocal_reference_report: src/AquaSynth.Core/PrimitiveReferenceReport.cs acoustic_graph_missing_pieces_audit: docs/acoustic-graph-missing-pieces-audit.md acoustic_graph_proprioception: docs/acoustic-graph-proprioception.md pink_trombone_parity_fixtures: src/AquaSynth.Core/PinkTromboneParityFixtures.cs diff --git a/state/memory.json b/state/memory.json index 7532b50..7fc263e 100644 --- a/state/memory.json +++ b/state/memory.json @@ -120,8 +120,8 @@ "binding_rule": "Parameter binding uses field-site references such as `lpf=@/macro/brightness` and `/opgraphs/0/operators/2/level`; the field owns meaning and the parameter owns the runtime value. Avoid target-routing semantics unless a new graph authority is deliberately mapped." }, "last_verified": { - "command": "dotnet build tests\\AquaSynth.Dsl.Tests\\AquaSynth.Dsl.Tests.csproj --no-restore --disable-build-servers -p:UseSharedCompilation=false -p:BuildInParallel=false -v minimal; dotnet test tests\\AquaSynth.Dsl.Tests\\AquaSynth.Dsl.Tests.csproj --no-restore --disable-build-servers -p:UseSharedCompilation=false -p:BuildInParallel=false --filter \"FullyQualifiedName~PatchScriptTests\" -v minimal; dotnet test tests\\AquaSynth.Dsl.Tests\\AquaSynth.Dsl.Tests.csproj --no-restore --disable-build-servers -p:UseSharedCompilation=false -p:BuildInParallel=false --filter \"PinkTromboneFixturesReportLogMelParityWhenFaustIsInstalled\" -v normal; dotnet test tests\\AquaSynth.Dsl.Tests\\AquaSynth.Dsl.Tests.csproj --no-restore --disable-build-servers -p:UseSharedCompilation=false -p:BuildInParallel=false --filter \"FaustCompilerValidatesPrimitiveVocalNetworkWhenInstalled\" -v normal", - "result": "Primitive vocal teardown cut builds; PatchScriptTests pass 84/84 including optional primitive Faust validation; PT Faust fixture diagnostic passes after demoting closure-release from sealed-silence authority to primitive diagnostic witness. A full unfiltered run was attempted first and hit the five-minute wall after leaving orphan dotnet workers, which were stopped before focused reruns.", + "command": "dotnet test tests\\AquaSynth.Dsl.Tests\\AquaSynth.Dsl.Tests.csproj --no-restore --disable-build-servers -p:UseSharedCompilation=false -p:BuildInParallel=false --filter \"FullyQualifiedName~PatchScriptTests\" -v minimal", + "result": "Primitive vocal telemetry/reference cut passes PatchScriptTests 86/86. Path timelines now include wave/passivity fields, and PT/SndKit static primitive comparison is covered. Earlier full unfiltered run hit the five-minute wall after leaving orphan dotnet workers; focused suites are the current reliable verification path.", "commit": "pending primitive vocal teardown" } } diff --git a/state/scratch.md b/state/scratch.md index 3589dfc..c88b52d 100644 --- a/state/scratch.md +++ b/state/scratch.md @@ -26,6 +26,15 @@ Current slice: new primitive DSL, PT tract adapter, primitive timeline, and fixture demotion away from generated graph banks. +- Second primitive evidence cut in progress: path telemetry now includes + `incoming_wave`, `outgoing_wave`, `energy_in`, `energy_out`, and + `passivity_ratio` in both Faust debug probes and `ProbeTimelineReport`. + Contact telemetry now includes `resistance`. Added + `PrimitiveReferenceReport.ComparePinkTrombone`, which compares static + primitive geometry/delay/branch/contact/radiation fields against PT/SndKit + fixture controls without requiring native reference binaries. `PatchScript` + tests pass 86/86 after this cut. + - Proprioception correction after user rejected baby-word golf as the rebuild owner. Diagnosis is now durable in `docs/acoustic-graph-proprioception.md`: collapse generated graph-vocal diff --git a/state/spine.yaml b/state/spine.yaml index be9ca4a..a9d26f2 100644 --- a/state/spine.yaml +++ b/state/spine.yaml @@ -30,6 +30,7 @@ current_mechanism: zyn_reference_source: external/zynaddsubfx pink_trombone_reference_source: external/pink-trombone-mod primitive_vocal_timeline: src/AquaSynth.Core/ProbeTimelineReport.cs + primitive_vocal_reference_report: src/AquaSynth.Core/PrimitiveReferenceReport.cs zyn_upstream_instrument_bank: external/zynaddsubfx/instruments zyn_reference_build_script: tools/zyn-reference/build-zyn-reference.ps1 zyn_pad_reference_renderer: tools/zyn-reference/ZynPadReference.cpp @@ -134,6 +135,7 @@ live_invariants: - Generated lip radiation opening must mirror live tract lip opening. The path-end geometry and radiation aperture are one mouth owner, not separate truths. Artifact `artifacts/parity/pink-trombone-utterance-logmel/20260529T141822464` improves papa's plosive failure sharply (RMS 0.8369, motor-band ratio 0.0555), but mama still sounds vowel-poor and thrombosis is still mostly absent; next pressure is vowel body/radiation color and fricative continuity. - Proprioception correction says baby words are downstream witnesses, not the rebuild owner. The live cut is to collapse generated graph-vocal lowering into a small set of instrumented physical primitives, compare primitive/sample-flow behavior against VTL, ArtiSynth, Story/TubeTalker, Smith/Faust, and PT/SndKit, then return to utterances once the tract body is observable. `docs/acoustic-graph-proprioception.md` owns this cut line. - First primitive vocal teardown cut is live. `tract`, `glottis`, `tract_injection`, and `nasal_branch` now adapt PT fixtures into `AreaFunction`, `WaveguidePath`, `SourcePort`, `ConstrictionContact`, `BranchPort`, `RadiationLoad`, `ProbeTimeline`, and `VocalNetwork` records instead of emitting generated `voices_0_area_*`, `voices_0_contact_*`, or `voices_0_inj_*` acoustic banks. The obsolete `EnsureTractAcousticNetwork` generator is deleted. Faust lowering for `Voice.VocalNetwork` emits compact primitive path/source/contact/branch/radiation locals using `de.fdelay*` delay families and debug probes under `/debug/...`; `ProbeTimelineReport` writes deterministic primitive CSV samples. Next pressure is passivity/energy timeline samples plus PT/SndKit timeline comparison, not intelligibility tuning. + - Primitive path telemetry now reports `incoming_wave`, `outgoing_wave`, `energy_in`, `energy_out`, and `passivity_ratio` in both Faust debug probes and `ProbeTimelineReport`; contact telemetry includes resistance. `PrimitiveReferenceReport.ComparePinkTrombone` compares static primitive area sections, length, reflection count, delay estimate, branch admittance, contact state, and radiation fields against local PT/SndKit fixture controls without adding a native reference dependency. Next pressure is per-block comparison against PT/SndKit internals, not static control matching alone. - TurbulenceJet now includes a release-timed burst-noise component in addition to the deterministic pressure pulse, but a stronger trial barely moved papa; the source is not the main remaining articulation bottleneck. Graph radiation now mixes 30% raw boundary flow with 70% high-passed flow after local admittance weighting, down from the over-bright 15/85 blend. Latest radiation/source artifact under `artifacts/parity/pink-trombone-utterance-logmel/20260527T174236049`: mama/papa/thrombosis cosine 0.6578/0.7692/0.5585, rmsRatio 3.0006/2.6153/2.3488, articulation 0.1437/0.1173/0.1191. Static `closure-release` under `artifacts/parity/pink-trombone-logmel/20260527T174139661` has rmsRatio 0.9900 and speechBandRatio 0.0842. This is still not speaking; next pressure is true tract resonance/passive scattering and pressure storage, not more burst gain. - Same-path two-port area discontinuities now emit `graph_area_energy_in_*` and `graph_area_energy_out_*` probes alongside the three-port branch `graph_connection_energy_*` probes. Use these to inspect passivity and formant-body failures at the scatter sites rather than judging only final output loudness. - `FaustExportOptions.DebugProbeUi` wraps graph probe signals in Faust `vbargraph` UI controls under `/debug/...` without changing audio output arity. Native streaming Faust patches now separate writable controls from read-only probe zones and can read/snapshot probe values after `ProcessBlock`; use this for acoustic graph passivity/radiation inspection, leave it off for normal parity renders. diff --git a/tests/AquaSynth.Dsl.Tests/PatchScriptTests.cs b/tests/AquaSynth.Dsl.Tests/PatchScriptTests.cs index c7ddf72..c230ac8 100644 --- a/tests/AquaSynth.Dsl.Tests/PatchScriptTests.cs +++ b/tests/AquaSynth.Dsl.Tests/PatchScriptTests.cs @@ -293,6 +293,11 @@ public sealed class PatchScriptTests Assert.Contains("primitive_radiated", export.Source); Assert.Contains("de.fdelay1a", export.Source); Assert.Contains("/debug/voice_0/path/oral/delay", export.Source); + Assert.Contains("/debug/voice_0/path/oral/incoming_wave", export.Source); + Assert.Contains("/debug/voice_0/path/oral/outgoing_wave", export.Source); + Assert.Contains("/debug/voice_0/path/oral/energy_in", export.Source); + Assert.Contains("/debug/voice_0/path/oral/energy_out", export.Source); + Assert.Contains("/debug/voice_0/path/oral/passivity_ratio", export.Source); Assert.Contains("/debug/voice_0/source/modal/flow", export.Source); Assert.Contains("/debug/voice_0/contact/lip_stop/released_flow", export.Source); Assert.Contains("/debug/voice_0/radiation/mouth/output", export.Source); @@ -316,16 +321,102 @@ public sealed class PatchScriptTests var samples = ProbeTimelineReport.Build(patch, "human", blocks: 2); Assert.Contains(samples, sample => sample.Primitive == "path:oral" && sample.Signal == "delay_samples"); + Assert.Contains(samples, sample => sample.Primitive == "path:oral" && sample.Signal == "incoming_wave"); + Assert.Contains(samples, sample => sample.Primitive == "path:oral" && sample.Signal == "outgoing_wave"); + Assert.Contains(samples, sample => sample.Primitive == "path:oral" && sample.Signal == "energy_in"); + Assert.Contains(samples, sample => sample.Primitive == "path:oral" && sample.Signal == "energy_out"); + Assert.Contains(samples, sample => sample.Primitive == "path:oral" && sample.Signal == "passivity_ratio"); Assert.Contains(samples, sample => sample.Primitive == "source:modal" && sample.Signal == "flow"); + Assert.Contains(samples, sample => sample.Primitive == "contact:lip_stop" && sample.Signal == "resistance"); Assert.Contains(samples, sample => sample.Primitive == "contact:lip_stop" && sample.Signal == "released_flow"); Assert.Contains(samples, sample => sample.Primitive == "radiation:mouth" && sample.Signal == "output"); + var passivity = samples.Single(sample => sample.Block == 0 && sample.Primitive == "path:oral" && sample.Signal == "passivity_ratio").Value; + Assert.InRange(passivity, 0, 1); var csv = ProbeTimelineReport.ToCsv(samples); Assert.StartsWith("block,primitive,signal,value", csv, StringComparison.Ordinal); + Assert.Contains("path:oral,passivity_ratio", csv); Assert.Contains("source:modal,flow", csv); Assert.Contains("radiation:mouth,output", csv); } + [Fact] + public void PrimitiveProbeTimelineExposesReferenceComparableFields() + { + var patch = PatchScript.Parse(""" + tract_shape name=human length_cm=17 diameters=.6,.8,1.2,1.6,1.3,.9 + nasal_branch name=nose length_cm=12 junction=3 velum=.35 diameters=.01,.35,.6,.8 + tract_injection name=inj position=4 width=1 turbulence=.2 burst=.5 + tract shape=human nasal_branch=nose injection=inj propagation=graph sections=6 constriction_index=4 constriction_diameter=.7 + """); + + var samples = ProbeTimelineReport.Build(patch, "voices_0_network", blocks: 1); + var fields = samples + .Select(sample => $"{sample.Primitive}:{sample.Signal}") + .ToHashSet(StringComparer.Ordinal); + + Assert.Contains("path:voices_0_oral:area", fields); + Assert.Contains("path:voices_0_oral:delay_samples", fields); + Assert.Contains("path:voices_0_oral:incoming_wave", fields); + Assert.Contains("path:voices_0_oral:outgoing_wave", fields); + Assert.Contains("path:voices_0_oral:energy_in", fields); + Assert.Contains("path:voices_0_oral:energy_out", fields); + Assert.Contains("path:voices_0_oral:passivity_ratio", fields); + Assert.Contains(samples, sample => sample.Primitive.StartsWith("source:voices_0_", StringComparison.Ordinal) && sample.Signal == "load_pressure"); + Assert.Contains(samples, sample => sample.Primitive.StartsWith("source:voices_0_", StringComparison.Ordinal) && sample.Signal == "flow"); + Assert.Contains("contact:voices_0_constriction:opening", fields); + Assert.Contains("contact:voices_0_constriction:resistance", fields); + Assert.Contains("contact:voices_0_constriction:reservoir", fields); + Assert.Contains("contact:voices_0_constriction:released_flow", fields); + Assert.Contains("branch:voices_0_velopharynx:admittance", fields); + Assert.Contains("branch:voices_0_velopharynx:exchanged_flow", fields); + Assert.Contains("radiation:voices_0_lip:reflection", fields); + Assert.Contains("radiation:voices_0_lip:boundary_flow", fields); + Assert.Contains("radiation:voices_0_lip:flow", fields); + Assert.Contains("radiation:voices_0_lip:output", fields); + + var pathPassivity = samples.Single(sample => + sample.Primitive == "path:voices_0_oral" && + sample.Signal == "passivity_ratio").Value; + Assert.InRange(pathPassivity, 0, 1); + } + + [Fact] + public void PrimitiveReferenceReportComparesPinkTromboneFixtureFields() + { + var fixture = PinkTromboneParityFixtures.ById("nasal-vowel"); + var patch = PatchScript.Parse(fixture.AquaScript); + + var rows = PrimitiveReferenceReport.ComparePinkTrombone(patch, "voices_0_network", fixture.Controls); + Assert.Contains(rows, row => + row.Reference == PrimitiveReferenceReport.PinkTromboneReference && + row.Primitive == "area:voices_0_morphology" && + row.Signal == "sections" && + row.Candidate == 44 && + row.Expected == 44); + Assert.Contains(rows, row => + row.Primitive == "area:voices_0_nasal_morphology" && + row.Signal == "sections" && + row.Candidate == 28 && + row.Expected == 28); + Assert.Contains(rows, row => + row.Primitive == "branch:voices_0_velopharynx" && + row.Signal == "admittance" && + MathF.Abs(row.Error) < 0.0001f); + Assert.Contains(rows, row => + row.Primitive == "contact:voices_0_constriction" && + row.Signal == "position" && + MathF.Abs(row.Error) < 0.0001f); + Assert.Contains(rows, row => + row.Primitive == "radiation:voices_0_lip" && + row.Signal == "reflection" && + MathF.Abs(row.Error) < 0.0001f); + + var csv = PrimitiveReferenceReport.ToCsv(rows); + Assert.StartsWith("reference,primitive,signal,candidate,expected,error", csv, StringComparison.Ordinal); + Assert.Contains("pt-sndkit,area:voices_0_morphology,sections,44,44,0", csv); + } + [Fact] public void SyrinxVoiceUsesPairedLoadedLabialSourcesThroughOneGraph() {