From 3ad54b9bb9cbab78df5ff39cf39c1511e79b5218 Mon Sep 17 00:00:00 2001 From: Aqua Date: Fri, 13 Nov 2026 02:40:22 +0000 Subject: [PATCH] Add /l/ to the IPA table: a lateral with a closed side stub The gate passed: a branch port joins the oral path at the ridge and a closed 3 cm stub notches 2-3 kHz by 13.4 dB against the same render with the port shut (the shut port is the render without the stub). The ladder cannot hold a second oral channel, so the midline is narrowed to 0.06 cm instead of closed. The scaffold declares the stub only for a word with a lateral; /apa aba ana ata/ keep script and Faust source byte for byte. Measured on /ala/: level -5.0 dB re the flanking vowels, F1 263 Hz, burst none. F2 725 Hz against the 1000-1300 design target: NOT met (reported). A lateral gesture without the side stub is refused, not approximated. Co-Authored-By: Claude Sonnet 5.5 --- .../articulatory-vocal-tract-sources.md | 4 +- src/AquaSynth.Core/IpaGestureExperiment.cs | 32 ++++++++- src/AquaSynth.Core/PatchScript.cs | 30 +++++++-- tests/AquaSynth.Dsl.Tests/PlaceTableTests.cs | 20 ++++++ .../StressAndReleaseRenderTests.cs | 65 +++++++++++++++++++ tests/AquaSynth.Dsl.Tests/WeksaPhonesTests.cs | 32 ++++++++- 6 files changed, 174 insertions(+), 9 deletions(-) diff --git a/docs/research/articulatory-vocal-tract-sources.md b/docs/research/articulatory-vocal-tract-sources.md index 24bfa8b..e4656cc 100644 --- a/docs/research/articulatory-vocal-tract-sources.md +++ b/docs/research/articulatory-vocal-tract-sources.md @@ -151,7 +151,9 @@ Re-measure 2026-11-12 on main c0e6b98 (`tools/formant-check/weak_spots.py` over - /k/, 2026-11-12 (the same /aka/ frame, closure 0.2 to 0.65 of the consonant, dB re the flanking vowels, burst removed): closure -14.9 dB against /p/ -20.4 and /t/ -24.9; the same closure with the glottal source's flow scale held at 0, -22.7 dB, so the tract seals and the leak is the voicing (150 Hz) the voiceless source still carries, reaching the output through a closure that leaves a short rear cavity. At the /t/ place (cell 36.7) the same /k/ gesture reads -24.8 dB, so it is the place and not the gesture. Silencing voicing in voiceless stops would change /p/ and /t/ (pinned); reported as an unmet criterion, not worked around. Velar place 9.81 cm behind the lips (0.44 of the tract; between /u/ narrowest dorsal section 26, 6.97 cm, and /a/ pharyngeal section 13, 12.14 cm). Burst: peak 0.0506 against the following vowel's 0.1129 (0.45), spectral peak 3100 Hz against Chodroff and Wilson 2014 /k/ 2868 Hz (/t/ 3950 Hz by the same measure); centroid 4626 Hz against /t/ 3629 Hz by the same measure (not judged: no literature centroid retrieved). Its injected burst peaked at 0.76 of the following vowel's peak at the shared gain 0.06 (/b/ 0.19): `TongueStopBurstGain` 0.03 gives 0.39 (0.0438 against 0.1129). Burst spectrum unchanged by the gain: peak 4011 Hz, centroid 5796 Hz, inside 3.5-7 kHz. Not met: /t/ above /p/ in burst peak (/p/ 7087 Hz above 1 kHz, 434 Hz below): the labial burst is still injected at the glottal end, which this branch pins. /k/ closure at the old 0.44 fraction is not sealed (core -15.7 dB). Unheard. - /d/, 2026-11-13 (table entry `voiced_alveolar_plosive`, no new mechanism: the `voiced` token selects the voice bar as it does for /b/): its consonant splines are identical to /t/'s (7 of 7: closure, contact, burst site and gain, source level aside), so closure position, duration and burst are /t/'s. Voice bar (word-initial, closure 0.03-0.058 s against the following vowel, deviation): /d/ -28.9 dB, /b/ -29.2, /t/ -38.7, /p/ -40.1; /d/ over /t/ 9.8 dB. Burst spectral peak 3950 Hz for both /d/ and /t/ (Chodroff and Wilson 2014: /d/ 4878, /t/ 5216, so the same place gives the same peak here, 0 Hz apart against their 338). Burst 0.0603 peak at its own release, 0.00002 before and 0.00000 after. The alveolar closure's voice bar does not differ from the labial one at this resolution (0.3 dB), so no number needed tuning. Unheard. -- Phones the tract cannot make: `WordRender` refuses /l/ with exit 4 (`UNSUPPORTED PHONES (the tract has no gesture for them; nothing rendered): l`); the table holds p b t d k m n s z ʃ ʒ ʍ w and the Story vowels. A direct `phoneme_gesture` on an unknown IPA symbol still falls back to an alveolar approximant (`GestureDescriptor`); not changed here. +- /l/, 2026-11-13 (gate then build; /ɑlɑ/ at 140 Hz, scaffold durations; no source for English /l/ formants or level is in the mind (`huginn known`), so every target is a DESIGN value from the cut spec: F1 250-400 Hz, F2 1000-1300 Hz, a dip at 2-3 kHz, level -4 to -10 dB re the flanking vowels, no burst). Gate: the ladder holds a lateral's antiresonance but not its parallel channel. A branch port joins the oral path at any cell (here the ridge, 2.555 cm from the lips) and a closed stub path (4 cells, cross-section 1 cm^2, end reflection +1, aperture 0) beside a sustained /ɑ/ notches the harmonics: stub 2.5 cm -12.3 dB at 2940 Hz, 3.0 cm (the built length) -13.4 dB at 2800 Hz in /ɑlɑ/, 3.6 cm -6.9 dB at 2940 Hz, 4.5 cm -7.9 dB at 2380 Hz, all against the same render with the port shut, which is the render without the stub to 0.0 dB. What the ladder cannot hold is a second oral channel that rejoins the oral path past the contact (a branch has one junction and ends in its own radiation), so the midline is narrowed rather than closed with the flow going round it. Built: the `lateral` token opens the `side_stub` branch for the gesture and narrows the midline to 0.06 cm (held to 0.8), the stub declared in the scaffold only for a word with a lateral (/apa aba ana ata/ keep their script and Faust source byte for byte). + Measured (Burg order 12, 20 ms frames, 0.205-0.255 s; level by RMS of the middle 60 percent re the flanking vowels): level -5.0 dB (band met), F1 263 Hz (met), F2 725 Hz (NOT met: 1000-1300; the narrowed tongue-tip constriction on the /ɑ/ body has no dorsal control to raise it), dip 13.4 dB under the stub-shut render at 2800 Hz (met), burst none (the render with and without release_flow is the same render). The midline diameter is a steep and non-monotonic lever on level and on formants together, so level and F1/F2 could not be set independently: midline 0.028 cm reads -7.2 dB but the spectrum is the sealed-tract leak (energy under 1 kHz, no F2); 0.04 -2.6; 0.05 -5.8 (F1 202); 0.06 -5.0 (F1 263, F2 725); 0.065 -2.5; 0.07 +0.4; 0.08 -0.5 (F1 287, F2 713); 0.15 -0.9 (F1 463, F2 737). Unheard. +- Phones the tract cannot make: `WordRender` refuses a phone outside the table with exit 4 (`UNSUPPORTED PHONES (the tract has no gesture for them; nothing rendered): `); the table holds p b t d k m n l s z ʃ ʒ ʍ w and the Story vowels. A direct `phoneme_gesture` on an unknown IPA symbol still falls back to an alveolar approximant (`GestureDescriptor`); not changed here. Mutations (hand-applied, restored, each run against the named tests): pitch ratio ignored, burst removed, burst not shaped by opening, burst gain x20 (0.06 to 1.2), stress duration ignored, stress pitch ignored, stress amplitude ignored, secondary equal to primary, probe timeline sample rate re-hardcoded to 48000: nine of nine killed. Script: `work/mut-b3.sh` in the aqua workspace. diff --git a/src/AquaSynth.Core/IpaGestureExperiment.cs b/src/AquaSynth.Core/IpaGestureExperiment.cs index b343df3..84a2c69 100644 --- a/src/AquaSynth.Core/IpaGestureExperiment.cs +++ b/src/AquaSynth.Core/IpaGestureExperiment.cs @@ -222,7 +222,33 @@ public static class IpaGestureExperiment start += duration; } - return Scaffold(lines, Math.Clamp(start + tailSeconds, 0.15f, 4f), frequency); + return Scaffold(lines, Math.Clamp(start + tailSeconds, 0.15f, 4f), frequency, phones.Any(phone => NeedsSideStub(phone.Target))); + } + + // A lateral is the one gesture that opens the side stub (PatchScript.SideStubBranch); a word without one is scaffolded without it, byte for byte. + private static bool NeedsSideStub(IpaGestureExperimentTarget target) => + (target.Descriptor.Length > 0 ? target.Descriptor : PatchScript.TryIpaDescriptor(target.Ipa, out var known) ? known : "") + .Contains("lateral", StringComparison.OrdinalIgnoreCase); + + // The sublingual cavity beside a lateral's midline contact: a closed side branch of the oral tract at the alveolar ridge. Its quarter-wave + // antiresonance (c / 4L, lowered by the junction and the orifice) is the lateral's dip; the length is a DESIGN VALUE placing it between 2 and 3 kHz + // (no primary dimension retrieved). Cross-section 1 cm^2, four cells of the stub's own morphology; the first cell is the orifice, the branch + // opening times the port maximum (NasalTractAreas). The end is closed (reflection +1, aperture 0: it radiates nothing). + private const string SideStubLengthCentimeters = "3"; + private const string SideStubAreas = "1,1,1,1"; + + private static string SideStubDeclarations(bool sideStub) + { + if (!sideStub) return ""; + PatchScript.TryPlaceDistanceCentimeters("alveolar", out var ridge); + var at = 1f - ridge / StoryVowelAreas.MeanLengthCentimeters; + return $""" + morphology name=side_stub length_cm={SideStubLengthCentimeters} areas={SideStubAreas} + waveguide_path name=side_stub_path morphology=side_stub speed={TractSpeedMetersPerSecond} strategy=thiran order=1 max_delay=4096 loss=.98 + branch_port name={PatchScript.SideStubBranch} from=oral_path from_position={Format(at)} to=side_stub_path opening=0 coupling=1 + radiation_load name=side_stub_end path=side_stub_path kind=lip position=1 aperture=0 reflection=1 impedance=.28 + + """; } private static string GestureLine(IpaGestureExperimentTarget target, float start, float duration, float intensity) => @@ -237,7 +263,7 @@ public static class IpaGestureExperiment // murmur read -4.2 dB (/m/) and -2.2 dB (/n/) re the flanking vowels; the target is 8 to 16 dB under (no primary level or bandwidth retrieved). private const string NasalPathLoss = ".975"; - private static string Scaffold(IReadOnlyList gestureLines, float sustain, float frequency) => $$""" + private static string Scaffold(IReadOnlyList gestureLines, float sustain, float frequency, bool sideStub = false) => $$""" patch gain=.45 morphology name=oral length_cm={{Format(StoryVowelAreas.MeanLengthCentimeters)}} diameters=.55,.75,1.05,1.45,1.25,.8 tongue_index=3 tongue_diameter=1.4 constriction_index=4 constriction_diameter=1 constriction_width=.03 lip_opening=4 vowel_set area_function=oral source={{StoryVowelAreas.Source}} @@ -250,7 +276,7 @@ public static class IpaGestureExperiment radiation_load name=mouth path=oral_path kind=lip position=1 aperture=.8 reflection=-1 impedance=.28 radiation_load name=nostril path=nasal_path kind=lip position=1 aperture=.8 reflection=-1 impedance=.28 probe_timeline name=flow network=voice blocks=12 block_size=64 - vocal_network name=voice paths=oral_path,nasal_path sources=folds contacts=contact branches=velopharynx radiation=mouth,nostril probe=flow + {{SideStubDeclarations(sideStub)}}vocal_network name=voice paths=oral_path,nasal_path{{(sideStub ? ",side_stub_path" : "")}} sources=folds contacts=contact branches=velopharynx{{(sideStub ? "," + PatchScript.SideStubBranch : "")}} radiation=mouth,nostril{{(sideStub ? ",side_stub_end" : "")}} probe=flow {{string.Join("\n", gestureLines)}} vocal network=voice freq={{Format(frequency)}} gain=.7 sustain={{Format(sustain)}} """; diff --git a/src/AquaSynth.Core/PatchScript.cs b/src/AquaSynth.Core/PatchScript.cs index d70de74..36540d4 100644 --- a/src/AquaSynth.Core/PatchScript.cs +++ b/src/AquaSynth.Core/PatchScript.cs @@ -13,6 +13,10 @@ public static class PatchScript /// that names another phone falls back to an alveolar approximant; a caller that must not be approximated asks here first. /// Vowels come from , the one table that also says which measured tract shape each selects. /// + /// The branch port a lateral gesture opens: a closed side stub beside the oral path at the alveolar ridge (the sublingual cavity). + /// A script that gestures a lateral without declaring it is refused, not approximated. + public const string SideStubBranch = "side_stub"; + public static bool TryIpaDescriptor(string ipa, out string descriptor) { if (StoryVowelAreas.TryVowelForIpa(ipa, out var vowelDescriptor, out _)) @@ -30,6 +34,7 @@ public static class PatchScript "k" => "voiceless_velar_plosive", "m" => "voiced_bilabial_nasal", "n" => "voiced_alveolar_nasal", + "l" => "voiced_alveolar_lateral_approximant", "s" => "voiceless_alveolar_fricative", "z" => "voiced_alveolar_fricative", "ʃ" => "voiceless_postalveolar_fricative", @@ -1559,7 +1564,7 @@ public static class PatchScript // A stop whose seal is the tongue (not the lips) is closed completely and until the contact opens (0.65): at the nasal's 0.03 cm // aperture a /t/ closure measured -10.4 dB re its vowels against /p/ -19.7 (the lips seal /p/ whatever the tongue does), and // rendered -21.5 dB with the aperture at 0 (area floor 1e-6 cm^2). - var closureHold = tokens.Contains("nasal") ? 0.8f : stopsBehindTheLips ? 0.65f : 0.5f; + var closureHold = tokens.Contains("nasal") || tokens.Contains("lateral") ? 0.8f : stopsBehindTheLips ? 0.65f : 0.5f; var closed = stopsBehindTheLips ? 0f : constriction; AddAuthoredSpline($"{name}_constriction_diameter", "/vocal/areas/0/area/constriction_diameter", start, duration, (0, closed), (closureHold, closed), (1, Math.Min(0.65f, constriction + 0.2f))); @@ -1583,7 +1588,7 @@ public static class PatchScript // it by the stored pressure and the opening (see PrimitiveContactExpression). The gain exists only around this plosive: // a surface holds its last value after its last point (and its first before its first), so a gain left at its level // made noise at every later contact state, the final nasal's closure and the tail included. - BurstGainAroundGesture($"{name}_release_flow", "/vocal/contacts/0/release_flow", start, duration, stopsBehindTheLips ? TongueStopBurstGain : PlosiveBurstGain); + GainAroundGesture($"{name}_release_flow", "/vocal/contacts/0/release_flow", start, duration, stopsBehindTheLips ? TongueStopBurstGain : PlosiveBurstGain); PlaceBurst(name, tokens, place, start, duration); AddAuthoredSpline($"{name}_velum", "/vocal/branches/0/opening", start, duration, (0, VelumClosed), (1, VelumClosed)); } @@ -1597,6 +1602,13 @@ public static class PatchScript { AddAuthoredSpline($"{name}_contact", "/vocal/contacts/0/opening", start, duration, (0, 0.55f), (1, 0.65f)); } + + // A lateral opens the side stub for its gesture and only then (the stub is closed before and after, as the burst gain is). + if (tokens.Contains("lateral") && _branchPortsByName.ContainsKey(SideStubBranch)) + { + var branch = _branchPorts.FindIndex(candidate => candidate.Name.Equals(SideStubBranch, StringComparison.OrdinalIgnoreCase)); + GainAroundGesture($"{name}_side_stub", $"/vocal/branches/{branch}/opening", start, duration, 1f); + } } // A vowel gesture raises the weight of the descriptor's Story vowel to 1 and holds every other vowel weight at 0 (the schwa and @@ -1643,9 +1655,9 @@ public static class PatchScript AddAuthoredSpline(name, surfacePath, start, duration, (0, normalized), (1, normalized)); } - // Zero before and after the gesture, the gain through it; the ramps are 0.15 of the gesture long and run into the neighbouring + // A surface that is zero before and after the gesture and the given level through it (the plosive burst gain, the lateral's side stub opening); the ramps are 0.15 of the gesture long and run into the neighbouring // phones (the leading one is cut where the word begins). - private void BurstGainAroundGesture(string name, string surfacePath, float start, float duration, float gain) + private void GainAroundGesture(string name, string surfacePath, float start, float duration, float gain) { if (!_controlSurfacesByPath.TryGetValue(surfacePath, out var surface) || surface.MaxValue <= surface.MinValue) { @@ -1751,6 +1763,10 @@ public static class PatchScript // than a cell; the mean of the two sections, 9.555 cm, would fall 0.3 cm from the nearest cell centre (not tried). private const float VelarCentimetersFromLips = 9.81f; + // The lateral's midline: the tongue tip meets the ridge and the flow leaves by the sides, here the side stub's neighbour, the oral path + // through a midline held nearly shut for the gesture (to 0.8, as the nasal). A DESIGN VALUE set so the lateral reads between the vowels and the nasals. + private const float LateralMidlineDiameter = 0.06f; + // Where a consonant closes. One entry per place, first token match wins. A place with a distance is placed by it, in cm behind the // lip plane, and its normalized position (0 glottis, 1 lips) is 1 - distance / tract length, for the vowel_set section index and the // hand-written-script fraction alike. A place with no distance is "fraction only": its fraction of the tract length from the glottis, @@ -1802,6 +1818,7 @@ public static class PatchScript { if (tokens.Contains("plosive") || tokens.Contains("stop") || tokens.Contains("nasal")) return 0.03f; if (tokens.Contains("fricative")) return 0.16f; + if (tokens.Contains("lateral")) return LateralMidlineDiameter; if (tokens.Contains("approximant")) return 0.48f; if (tokens.Contains("trill") || tokens.Contains("tap") || tokens.Contains("flap")) return 0.24f; return 0.55f; @@ -2791,6 +2808,11 @@ public static class PatchScript var intensity = Math.Clamp(GetFloat(fields, line, 1, "intensity", "gain", "strength"), 0, 2); var pitchRatio = Math.Clamp(GetFloat(fields, line, 1, "pitch_ratio", "f0_ratio"), 0.5f, 2f); var descriptor = GestureDescriptor(ipa, fields); + if (DescriptorTokens(descriptor).Contains("lateral") && !_branchPortsByName.ContainsKey(SideStubBranch)) + { + throw new PatchScriptException(line, $"a lateral gesture needs the `{SideStubBranch}` branch port (the sublingual stub); it is not approximated by a plain approximant"); + } + var name = TryGetAny(fields, ["name", "n"], out var nameText) ? nameText : $"ipa_{SafeName(ipa)}_{_phonemeGestures.Count}"; diff --git a/tests/AquaSynth.Dsl.Tests/PlaceTableTests.cs b/tests/AquaSynth.Dsl.Tests/PlaceTableTests.cs index e920033..6813300 100644 --- a/tests/AquaSynth.Dsl.Tests/PlaceTableTests.cs +++ b/tests/AquaSynth.Dsl.Tests/PlaceTableTests.cs @@ -40,6 +40,26 @@ public sealed class PlaceTableTests(ITestOutputHelper output) Assert.Equal(NIndex, n); } + // The side stub is declared only for a word with a lateral: the script and the Faust source of /apa/ /aba/ /ana/ /ata/ are the bytes the scaffold + // gave before the lateral cut (SHA-256 prefixes taken on the head of /k/, 8d50819 plus /d/). + [Fact] + public void ExistingWordsSourcesUnchanged() + { + foreach (var (ipa, scriptSha, faustSha) in new[] + { + ("p", "61A96E0AE8C68F52", "28022E56A77DB5B1"), ("b", "5D5A6B653DC5D37D", "2FB84E792B878BFE"), + ("n", "BDF24A66659D7BD6", "ABEB5D03DC9637DB"), ("t", "9DFBCDB5131F9776", "30E144D54F7E026F"), + }) + { + var script = Word(ipa); + var faust = FaustEmitter.Emit(PatchScript.Parse(script), new FaustExportOptions("pin", SampleRate: 48000)).Source; + Assert.Equal(scriptSha, Sha(script)); + Assert.Equal(faustSha, Sha(faust)); + } + + Assert.Contains(PatchScript.SideStubBranch, Word("l")); + } + [Fact] public void UnknownPlaceHasNoDistance() { diff --git a/tests/AquaSynth.Dsl.Tests/StressAndReleaseRenderTests.cs b/tests/AquaSynth.Dsl.Tests/StressAndReleaseRenderTests.cs index 1b5a7a4..7d7d81b 100644 --- a/tests/AquaSynth.Dsl.Tests/StressAndReleaseRenderTests.cs +++ b/tests/AquaSynth.Dsl.Tests/StressAndReleaseRenderTests.cs @@ -473,4 +473,69 @@ public sealed class StressAndReleaseRenderTests(ITestOutputHelper output) Assert.True(leading < atRelease / 20, "no burst before the plosive's own gesture"); Assert.True(trailing < atRelease / 10, "no burst after the plosive"); } + + // /l/ over /ɑ _ ɑ/ at the scaffold's durations. Envelope of the consonant's middle 60 percent at the harmonics of f0 (the largest power within a + // quarter of f0 of k * f0), in dB: the spectrum of a periodic source is a line spectrum, so extrema are read from the harmonic envelope. + private (double[] Hz, double[] Db) HarmonicEnvelope(float[] x, double from, double to, double f0 = 140, double maxHz = 5000) + { + var a = (int)((from + 0.2 * (to - from)) * Rate); + var n = (int)(0.6 * (to - from) * Rate); + var seg = Enumerable.Range(0, n).Select(i => x[a + i] * (0.5 - 0.5 * Math.Cos(2 * Math.PI * i / (n - 1)))).ToArray(); + double Power(double hz) + { + double re = 0, im = 0; + for (var i = 0; i < n; i++) { var w = 2 * Math.PI * hz * i / Rate; re += seg[i] * Math.Cos(w); im -= seg[i] * Math.Sin(w); } + return re * re + im * im; + } + + var hz = new List(); + var db = new List(); + for (var k = 1; k * f0 < maxHz; k++) + { + hz.Add(k * f0); + db.Add(10 * Math.Log10(Math.Max(1e-30, Enumerable.Range(-3, 7).Max(j => Power(k * f0 + j * f0 / 12))))); + } + + return (hz.ToArray(), db.ToArray()); + } + + // The lateral's own dip: the envelope with the side stub open less the same render with it shut, at its lowest between 2 and 3 kHz. The + // difference isolates the stub's antiresonance from the valleys between the vowel's formants, which the shut render has as deep. + private static (double DipHz, double Depth) LateralDip(double[] hz, double[] db, double[] shutDb) + { + var i = Enumerable.Range(0, hz.Length).Where(j => hz[j] >= 2000 && hz[j] <= 3000).MinBy(j => db[j] - shutDb[j]); + return (hz[i], shutDb[i] - db[i]); + } + + // The lateral's antiresonance: the closed side stub beside the oral path (sublingual cavity). With the stub open the 2 to 3 kHz harmonics fall at + // least 6 dB under the same render with it shut (a DESIGN criterion; no /l/ spectrum was retrieved). The lateral is continuous: the render with + // and without release_flow is the same render. + [Fact] + public void LateralHasAnAntiresonanceAndNoBurst() + { + var (x, from, to) = VowelConsonantVowel("l"); + if (x is null) return; + var (hz, db) = HarmonicEnvelope(x, from, to); + var (shut, _, _) = VowelConsonantVowel("l", edit: WithShutSideStub); + var (_, shutDb) = HarmonicEnvelope(shut!, from, to); + var (dipHz, depth) = LateralDip(hz, db, shutDb); + var (nb, _, _) = VowelConsonantVowel("l", edit: WithoutBurst); + output.WriteLine($"/l/ stub open {depth:F1} dB under stub shut at {dipHz:F0} Hz (2-3 kHz); max |with - without release_flow| {x.Zip(nb!, (a, b) => Math.Abs(a - b)).Max():G3}"); + Assert.True(depth >= 6, $"the 2-3 kHz dip is {depth:F1} dB under the shut-stub render"); + Assert.Equal(x, nb); + } + + private static SynthPatch WithShutSideStub(SynthPatch p) => + p with { ControlSplines = p.ControlSplines.Where(s => s.SurfacePath != "/vocal/branches/1/opening").ToArray() }; + + // Between the vowels and the nasals in level: -4 to -10 dB re the flanking vowels (a DESIGN band; /n/ reads -9.6, /m/ -11.8 in the same measure). + [Fact] + public void LateralLevelIsBetweenTheVowelsAndTheNasals() + { + var (x, from, to) = VowelConsonantVowel("l"); + if (x is null) return; + var db = ConsonantDbReVowels(x, from, to); + output.WriteLine($"/l/ {db:F1} dB re the flanking vowels"); + Assert.InRange(db, -10, -4); + } } diff --git a/tests/AquaSynth.Dsl.Tests/WeksaPhonesTests.cs b/tests/AquaSynth.Dsl.Tests/WeksaPhonesTests.cs index ccf47e6..3f0994f 100644 --- a/tests/AquaSynth.Dsl.Tests/WeksaPhonesTests.cs +++ b/tests/AquaSynth.Dsl.Tests/WeksaPhonesTests.cs @@ -96,6 +96,36 @@ public sealed class WeksaPhonesTests Assert.Contains(patch.ControlSplines, s => s.SurfacePath == "/vocal/contacts/0/release_flow" && s.Name.StartsWith("ada_1_d", StringComparison.Ordinal)); } + // The lateral gate passed (a closed side stub on the oral path gives a dip: LateralHasAnAntiresonanceAndNoBurst), so /l/ is in the table, as a + // lateral and never as the approximant GestureDescriptor falls back to. + [Fact] + public void LateralGateOutcomeIsRecorded() + { + var word = WeksaPhonesReader.Parse(Line($"[{Ph("ɑ", "none")},{Ph("l", "none")},{Ph("ɑ", "none")}]")); + var plan = WeksaWordPlan.From(word, "ala"); + Assert.True(plan.Renderable, string.Join(",", plan.Unsupported.Select(p => p.Ipa))); + Assert.Empty(plan.Unsupported); + Assert.True(PatchScript.TryIpaDescriptor("l", out var descriptor)); + Assert.Equal("voiced_alveolar_lateral_approximant", descriptor); + Assert.NotEqual("voiced_alveolar_approximant", descriptor); + var script = IpaGestureExperiment.BuildWordScript(plan.Phones.ToArray(), 140); + var patch = PatchScript.Parse(script); + Assert.Contains(patch.BranchPorts, b => b.Name == PatchScript.SideStubBranch); + Assert.Contains(patch.ControlSplines, s => s.SurfacePath == "/vocal/branches/1/opening" && s.Name.StartsWith("ala_1_l", StringComparison.Ordinal)); + // continuous, no burst: the lateral has no release_flow spline at all + Assert.DoesNotContain(patch.ControlSplines, s => s.SurfacePath == "/vocal/contacts/0/release_flow" && s.Name.StartsWith("ala_1_l", StringComparison.Ordinal)); + } + + // A lateral gesture on a scaffold without the side stub is refused, not rendered as an approximant. + [Fact] + public void ALateralWithoutTheSideStubIsRefused() + { + var script = IpaGestureExperiment.BuildWordScript([(new IpaGestureExperimentTarget("w_0_a", "a", "", 0.18f), 1f)], 140) + + "\nphoneme_gesture name=w_hand ipa=l descriptor=voiced_alveolar_lateral_approximant start=.2 dur=.1 intensity=1"; + var error = Assert.Throws(() => PatchScript.Parse(script)); + Assert.Contains(PatchScript.SideStubBranch, error.Message); + } + [Fact] public void WeksaWordPlanAcceptsK() { @@ -176,7 +206,7 @@ public sealed class WeksaPhonesTests { foreach (var ipa in new[] { "n", "i", "b", "u", "a", "ə", "ɪ", "ʊ", "e", "ɛ", "æ", "ʌ", "ɑ", "ɔ", "o" }) Assert.True(PatchScript.TryIpaDescriptor(ipa, out var descriptor) && descriptor.EndsWith("_vowel", StringComparison.Ordinal) == "iuaəɪʊeɛæʌɑɔo".Contains(ipa)); - foreach (var ipa in new[] { "ŋ", "θ", "ɹ", "l" }) + foreach (var ipa in new[] { "ŋ", "θ", "ɹ" }) Assert.False(PatchScript.TryIpaDescriptor(ipa, out _)); } }