Document physical voice modeling direction

This commit is contained in:
Meta Vens 2026-05-26 14:40:57 +01:00
commit 58de311fc1
3 changed files with 196 additions and 0 deletions

View file

@ -0,0 +1,193 @@
# Physical Voice Modeling Research Pass
## Objective
Generalize AquaSynth voice modeling beyond Pink Trombone. The target is a
performant, Faust-friendly acoustic modeling layer that can express a larynx,
syrinx, or stranger anatomy from the same primitives:
```text
continuous morphology + acoustic source ports + propagation network
-> generated Faust
-> differentiable controls and log-mel/audio parity
```
Pink Trombone remains useful pressure, but its 44 oral cells, 28 nasal cells,
and twice-per-sample step loop are implementation evidence, not the language.
## Research Grounding
The useful physical model is still a wave/acoustic network, not a formant knob
pile.
- Digital waveguides are a standard efficient representation for 1D acoustic
systems. Faust's `physmodels.lib` is built around this exact class of
structures: bidirectional chains, waveguides, terminations, tubes, reeds,
lips, bows, and other port interactions.
- Faust `physmodels.lib` exposes `pm.chain` for bidirectional physical-model
blocks, `pm.l2s` for length-to-samples conversion using wave speed and sample
rate, and `pm.waveguideUd`, `pm.waveguideFd`, `pm.waveguideFd2`, and
`pm.waveguideFd4` for unit and fractional delay waveguides.
- Faust `delays.lib` exposes several delay families relevant to this work:
`de.fdelay` for simple linear fractional delay, Lagrange fractional delays
through `de.fdelayltv` and `de.fdelay1..5`, and Thiran/allpass delays through
`de.fdelay1a..4a`. The allpass family preserves magnitude better but has
explicit lower-delay stability limits; first-order Thiran bottoms out around
a half sample.
- Vocal-tract waveguide literature treats half-sample Kelly-Lochbaum models as
useful for speech research and uses fractional-delay filters to vary segment
lengths continuously without changing sampling rate.
- Recent differentiable speech work is converging on the same division:
physically meaningful low-dimensional articulatory controls feed differentiable
acoustic models or differentiable approximations of them. The important point
is not whether the model is literally PT; it is whether the controls are
smooth, bounded, interpretable, and connected to the rendered loss.
Primary sources consulted:
- Faust libraries, `physmodels.lib`: https://faustlibraries.grame.fr/libs/physmodels/
- Local Faust 2.85.5 `physmodels.lib` and `delays.lib` under
`C:\Program Files\Faust\share\faust\`.
- Mathur, Story, Rodriguez, "Vocal-tract modeling: Fractional elongation of
segment lengths in a waveguide model with half-sample delays":
https://doi.org/10.1109/TSA.2005.858550
- Mullen, Howard, Murphy, "Waveguide Physical Modeling of Vocal Tract
Acoustics":
https://eprints.whiterose.ac.uk/3713/
- Frontiers DDSP review section on differentiable source-filter and
differentiable Pink Trombone-style articulatory estimation:
https://www.frontiersin.org/journals/signal-processing/articles/10.3389/frsip.2023.1284100/full
## Authority Map
Owner: `AcousticMorphology`
- Owns continuous geometry: length, cross-sectional area/diameter curves,
branch curves, radiation openings, and source-port positions.
- Does not own emitted grid size, PT section count, or Faust delay mechanics.
Owner: `AcousticPortNetwork`
- Owns topology: ports, directed wave variables, tube segments, scattering
junctions, source couplings, branch junctions, and terminations.
- A larynx and a syrinx differ here mostly by source topology:
- larynx: one primary glottal source feeding one tract;
- syrinx: two independently controllable labial/bronchial source ports that
can couple into a shared tracheal/oral path.
- Alien voices are additional source ports, branch graphs, nonlinear junctions,
and radiation ports, not new special-case voice modules.
Owner: `WaveClock`
- Owns conversion from physical length to delay samples:
`delaySamples = lengthMeters * sampleRate / propagationSpeed`.
- Chooses a lowering strategy per segment:
- unit-delay compiled grid for cheap static geometry;
- first-order Thiran/allpass for near-half-sample stable fractional delays;
- Lagrange/linear delay for FIR-like interpolation where magnitude error is
acceptable;
- smoothed crossfaded variable delay when length changes rapidly.
- `substeps` is no longer an owner. It is a historical clue.
Owner: `DifferentiableControls`
- Owns the trainable/control surface:
- normalized positions along named paths;
- positive radii/areas via bounded or softplus-like transforms;
- source pressure/tension/open quotient/noise as bounded continuous controls;
- coupling/opening coefficients constrained into passive ranges;
- slew rates and gesture envelopes as smooth controls.
- Does not expose raw emitted section indices as the primary interface.
## Faust Lowering Choices
### Keep Custom Generated Scattering For Articulatory Tracts
Faust `pm.chain` is attractive for generic bidirectional blocks, but AquaSynth
still needs generated named equations for tract-like acoustic networks because:
- the number of junctions and branch topology are compile-time graph shape;
- live controls must update areas, reflection coefficients, and source weights;
- generated code needs inspectable parameter names for training/playground use;
- nasal, lateral, syrinx, and alien branch points need multi-port scattering
rather than a fixed string/tube model.
The current `wg_loop ~ si.bus(...)` shape remains plausible as the low-level
state owner. It should learn from Faust's physical-modeling library instead of
pretending the library does not exist.
### Use Faust Library Delay Blocks Where They Match The Segment
For future non-uniform segments, generate delay elements from the library:
- `de.fdelay(max, delay)` for simple fractional delay and quick parity probes.
- `de.fdelay1a(max, delay)` or related Thiran/allpass delays for magnitude-flat
near-half-sample interpolation when the delay is within the documented stable
range.
- `de.fdelayltv(order, max, delay)` or `de.fdelay1..5` when smooth variable
segment length matters more than allpass phase behavior.
- `pm.waveguideFd4(max, delay)` for larger bidirectional tube segments that can
live as chain blocks.
Do not blindly place arbitrary fractional delay inside every scattering edge.
For very short sections below a stable allpass delay bound, either:
- choose a coarser emitted scattering grid and let the area curve resample onto
it; or
- use a half-sample KL structure where the delay model is explicitly designed
for that regime.
### Separate Fast Training From Final Rendering
Aqua should support at least two lowerings from the same acoustic morphology:
1. `waveguide-grid`: realtime Faust waveguide network for listening, gameplay,
and high-fidelity parity.
2. `response-proxy`: differentiable transfer-function or modal/SOS proxy for
fast optimization, initialized from the same geometry and periodically
checked against the waveguide render.
That is not a cheat if the proxy is named and falsified by audio parity. It is
how the machine avoids making every gradient step pay for a full acoustic body.
## DSL Direction
Replace PT-shaped source words with physical voice words.
Preferred concepts:
- `morphology`: named continuous acoustic body.
- `path`: oral, nasal, bronchial, lateral, resonator, alien named tube/path.
- `branch`: topology edge between paths, with opening/coupling control.
- `source_port`: acoustic excitation port; can be glottal, labial, reed,
turbulent jet, click cavity, or synthetic/alien.
- `radiation_port`: lip, nostril, beak, membrane aperture, side vent.
- `gesture`: smooth control over areas, openings, source parameters, and
branch couplings.
- `wave_clock`: propagation speed, delay strategy, and emitted-grid policy.
Avoid concepts as primary public abstractions:
- `substeps`;
- `44 sections`;
- `glottis` as the only source kind;
- `nose` as the only branch kind;
- integer cell index controls as the trainable interface.
## Next Implementation Cut
Add model records before more audio golf:
- `AcousticPath`: name, length, area curve, propagation speed, loss profile.
- `AcousticBranch`: from path/position to path/position, opening/coupling,
branch kind.
- `AcousticSourcePort`: path/position, source model, pressure/tension/noise
controls.
- `AcousticRadiationPort`: path/position, opening/reflection/radiation filter.
- `WaveClockPolicy`: unit grid, half-sample grid, fractional delay order, max
delay, and smoothing mode.
Then lower the current PT fixtures through those records as one larynx-shaped
configuration. A syrinx should be expressible by adding two source ports and a
bronchial/tracheal branch topology, not by forking the tract voice.

View file

@ -142,3 +142,4 @@
{"timestamp":"2026-05-26T09:37:00+01:00","topic":"pink-trombone-waveguide-faust-loop","claim":"The Pink Trombone waveguide lowering now uses one Faust feedback component (`wg_loop ~ si.bus(...)`) instead of scalar named recursive equations. Full 44-section oral and 28-section nasal waveguide candidates compile/render through Faust. Current log-mel cosine baseline: open vowel 0.5578, front vowel 0.5368, nasal 0.4299, sibilant 0.2852, closure-release 0.1147.","evidence":"dotnet test tests/AquaSynth.Dsl.Tests/AquaSynth.Dsl.Tests.csproj --no-build --filter PinkTromboneFixturesReportLogMelParityWhenFaustIsInstalled -v minimal passed; artifacts/parity/pink-trombone-logmel/20260526T093628426/summary.txt"}
{"timestamp":"2026-05-26T10:10:00+01:00","topic":"continuous-tract-morphology","claim":"PT's 44 oral cells are a reference grid, not anatomy. A 17 cm tract split into 44 cells at 44.1 kHz has about 0.5 samples of acoustic delay per cell, so PT-style substeps are pressure for fractional-delay waveguide lowering rather than a durable Aqua DSL primitive. `TractAreaFunction` now owns physical length, normalized interpolation, resampling, and per-cell delay derivation; `tract sections=...` can choose a compiled lowering grid without forcing the named morphology's authoring sample count to match.","evidence":"Added `length_cm` parsing for `tract_shape`/`nasal_branch`, `TractAreaFunction.DiameterAt`, `Resample`, and `CellDelaySamples`; focused tests cover continuous interpolation, authoring-grid/lowering-grid separation, and the 44-cell half-sample delay fact."}
{"timestamp":"2026-05-26T10:43:00+01:00","topic":"pink-trombone-acoustic-grid-parity","claim":"Waveguide tracts now default to a compiled acoustic unit-delay grid derived from physical length at the 44.1 kHz target. PT's 17 cm / 44-cell shape lowers to about 22 emitted oral sections; nasal length 12 cm lowers to 15 sections. `VocalTract.IndexScale` maps runtime PT-index controls onto the emitted grid so parameter knobs remain in source morphology coordinates. Removing stale `substeps=2` from PT parity fixtures and applying index scaling improved vowels/sibilant but exposed closure as still wrong: open 0.6143, front 0.6349, nasal 0.5425, sibilant 0.3744, closure-release -0.0820.","evidence":"dotnet test tests/AquaSynth.Dsl.Tests/AquaSynth.Dsl.Tests.csproj --no-build --filter \"WaveguideTractDefaultsToAcousticUnitDelayGrid|PinkTromboneParityFixturesUseReusableLowLevelPrimitives|PinkTromboneFixturesReportLogMelParityWhenFaustIsInstalled\" -v minimal passed; artifacts/parity/pink-trombone-logmel/20260526T104229319/summary.txt"}
{"timestamp":"2026-05-26T11:03:00+01:00","topic":"physical-voice-modeling-research","claim":"The next voice architecture should be an acoustic port network, not a Pink Trombone module: continuous morphology owns paths/area curves, source ports model larynx/syrinx/reed/noise exciters, branch and radiation ports own topology, and wave-clock policies choose unit/half-sample/fractional-delay lowering. Faust `physmodels.lib` and `delays.lib` provide relevant primitives (`pm.chain`, `pm.l2s`, `pm.waveguideFd*`, `de.fdelay*`, Lagrange, Thiran/allpass), but AquaSynth should generate custom scattering where live area controls and inspectable differentiable parameters matter.","evidence":"Added docs/physical-voice-modeling-research.md after checking Faust 2.85.5 local libraries plus primary literature on half-sample/fractional-delay vocal-tract waveguides, waveguide tract acoustics, and differentiable articulatory/source-filter synthesis."}

View file

@ -44,6 +44,7 @@ current_mechanism:
utterance_parity_research: docs/utterance-parity-research.md
pink_trombone_parity: docs/pink-trombone-parity.md
pink_trombone_dsl_parity_plan: docs/pink-trombone-dsl-parity-plan.md
physical_voice_modeling_research: docs/physical-voice-modeling-research.md
parameter_contracts: src/AquaSynth.Core/Model.cs
live_invariants:
@ -112,6 +113,7 @@ live_invariants:
- The speech lane is the active center: IPA parity, utterance embeddings, synth-driver automation, rendered loss, and compiled Faust control sweeps take priority over new DX7/Zyn digestion.
- Every learned speech arrow must stay inspectable: utterance metadata -> embedding, embedding plus phonetic features -> automation, automation -> rendered audio, rendered audio -> loss/gradient.
- Pink Trombone parity is structural waveguide pressure, not permission to add more formant proxy knobs. AquaSynth now has a `tract` DSL command that lowers into `Voice.Tract` with PT-shaped runtime controls and a Faust tract-voice proxy; it is still an ordinary voice treatment, not a separate graph owner and not an exact 44-cell/28-cell bidirectional waveguide.
- Physical voice modeling should generalize around continuous acoustic morphologies, acoustic port networks, source ports, branch/radiation ports, and wave-clock policies. A larynx, syrinx, or alien voice should differ by topology and source-port configuration, not by special-case modules. Faust `physmodels.lib`/`delays.lib` provide useful primitives (`pm.chain`, `pm.l2s`, `pm.waveguideFd*`, `de.fdelay*`, Thiran/allpass and Lagrange delays), but AquaSynth should still generate tract/branch scattering where live area controls and inspectable training parameters matter.
- PT expressive parity should decompose into reusable Aqua primitives before audio golf: `tract_shape` owns continuous diameter/area geometry over normalized position, physical length (`length_cm`), interpolation/resampling, derived reflection coefficients, and per-cell acoustic delay; `tract` may resample that geometry to a chosen compiled `sections` grid without making authoring sample count anatomy; `glottis` owns excitation controls; `tract_injection` owns positioned frication/burst controls and now distributes frication pressure into waveguide section updates; `nasal_branch` owns a second diameter/area tube; `tract_motion` owns control slew and obstruction threshold; `propagation=waveguide` lowers tract voices into a Faust-friendly `wg_loop ~ si.bus(...)` feedback component with compiled right/left traveling-wave state, live per-section diameter/area/reflection fields, obstruction-history burst pressure, and legacy substep clock intent. Waveguide tracts now default to an acoustic unit-delay grid from physical length at the current 44.1 kHz target, so a 17 cm oral tract emits about 22 sections instead of treating PT's 44 half-sample cells as anatomy; `VocalTract.IndexScale` maps runtime PT-index controls onto that emitted grid. PT's 44 oral and 28 nasal cells are reference discretization, not Aqua morphology authority. `PinkTromboneParityFixtures` defines fixed Aqua DSL workouts, `PinkTromboneReferenceRenderer` renders deterministic PT-style fixture references, and `AudioComparison` includes log-mel cosine similarity. Current waveguide baseline is weak but measured: cosine about 0.61 open vowel, 0.63 front vowel, 0.54 nasal, 0.37 sibilant, and -0.08 closure-release. Remaining low-level gap is fractional-delay waveguide lowering whose clock derives from physical length, propagation speed, and sample rate so runtime morphology motion does not require recompilation; closure/release timing is still badly wrong.
- If dotnet builds hang in this workspace, stop orphan dotnet workers and retry with `--disable-build-servers -p:UseSharedCompilation=false -p:BuildInParallel=false`; plain parallel/shared builds can stall without useful diagnostics.
- eSpeak NG is an early parity reference for timing, IPA coverage, and log-mel pressure, not an anatomy oracle or final target.