From 0242f385e5cb295f7f9248375528982e651f2db2 Mon Sep 17 00:00:00 2001 From: Aqua Date: Sun, 8 Nov 2026 04:04:03 +0000 Subject: [PATCH] Vowel gestures keep the radiating aperture open: the lip cell already carries the lip area The gesture also scaled the aperture (an output gain and highpass corner) by lip cm / 2.2, so /u/ (lip .05 cm) rendered 29 dB under /i/. A vowel now holds aperture at 1; consonant closures still use it. Test: /u/ rms within -10..+3 dB of /i/, F2 under 1000 Hz. Co-Authored-By: Claude Sonnet 5.5 --- src/AquaSynth.Core/PatchScript.cs | 10 +++--- .../VocalTractFormantTests.cs | 34 +++++++++++++++---- 2 files changed, 34 insertions(+), 10 deletions(-) diff --git a/src/AquaSynth.Core/PatchScript.cs b/src/AquaSynth.Core/PatchScript.cs index 5d07533..53f56bc 100644 --- a/src/AquaSynth.Core/PatchScript.cs +++ b/src/AquaSynth.Core/PatchScript.cs @@ -1450,7 +1450,7 @@ public static class PatchScript if (tokens.Contains("vowel")) { - EmitVowelGesture(name, tokens, start, duration, intensity); + EmitVowelGesture(name, tokens, start, duration); return; } @@ -1503,7 +1503,7 @@ public static class PatchScript (0.5f, 0.5f, 0, 2.00f, 1.20f, 0.60f), // schwa 497/1503 ]; - private void EmitVowelGesture(string name, HashSet tokens, float start, float duration, float intensity) + private void EmitVowelGesture(string name, HashSet tokens, float start, float duration) { var front = tokens.Contains("front") ? 1f : tokens.Contains("back") ? 0f : 0.5f; var open = tokens.Contains("close") ? 0f : tokens.Contains("mid") ? 0.5f : tokens.Contains("open") ? 1f : 0.5f; @@ -1516,8 +1516,10 @@ public static class PatchScript HoldOnSurface($"{name}_lip_area", "/vocal/areas/0/area/lip_opening", start, duration, shape.LipCm); // A vowel leaves the tract unconstricted: hold the constriction at the surface maximum. AddAuthoredSpline($"{name}_constriction_diameter", "/vocal/areas/0/area/constriction_diameter", start, duration, (0, 1), (1, 1)); - var aperture = Math.Clamp(shape.LipCm / 2.2f * (0.9f + 0.1f * intensity), 0.02f, 1); - AddAuthoredSpline($"{name}_lip_radiation", "/vocal/radiation/0/aperture", start, duration, (0, aperture), (1, aperture)); + // The ladder's lip cell already carries the lip area into the resonance and the level. Aperture is the radiating + // gain the consonant closures use (the lip cell cannot shut), so a vowel keeps it fully open; scaling it by the lip + // area as well counted the rounding twice and left /u/ 30 dB under /i/. + AddAuthoredSpline($"{name}_lip_radiation", "/vocal/radiation/0/aperture", start, duration, (0, 1), (1, 1)); AddAuthoredSpline($"{name}_velum", "/vocal/branches/0/opening", start, duration, (0, 0.01f), (1, 0.01f)); } diff --git a/tests/AquaSynth.Dsl.Tests/VocalTractFormantTests.cs b/tests/AquaSynth.Dsl.Tests/VocalTractFormantTests.cs index 024d22a..400ceb3 100644 --- a/tests/AquaSynth.Dsl.Tests/VocalTractFormantTests.cs +++ b/tests/AquaSynth.Dsl.Tests/VocalTractFormantTests.cs @@ -194,12 +194,17 @@ public sealed class VocalTractFormantTests(ITestOutputHelper output) // The authored vowel gestures (PatchScript's VowelShapes, reached through the IPA word script) rendered end to end through the // exporter, merged splines and the ladder; the source is a bright 10 Hz saw so the tract's response is sampled densely. - private double[]? GesturePeaks(string ipa) + private float[]? GestureWindow(string ipa) { var script = IpaGestureExperiment.BuildWordScript([(new IpaGestureExperimentTarget($"v_{ipa}", ipa, "", 1.5f), 1f)], Pitch, 0.1f) .Replace("noise=.04", "noise=0 tilt=1", StringComparison.Ordinal) .Replace($"freq={Pitch}", $"freq={Pitch} min_freq=5", StringComparison.Ordinal); - var window = Render(script); + return Render(script); + } + + private double[]? GesturePeaks(string ipa) + { + var window = GestureWindow(ipa); if (window is null) return null; var peaks = LpcPeaks(window); output.WriteLine($"gesture {ipa}: peaks " + string.Join(" ", peaks.Select(p => p.ToString("F0")))); @@ -286,11 +291,12 @@ public sealed class VocalTractFormantTests(ITestOutputHelper output) [Fact] public void AuthoredRoundedBackVowelPlacesF2NearTheTextbook() { - // u's F1 (about 290 Hz) is under the order-12 envelope's resolution; its F2 is the lowest peak it resolves. + // The radiating highpass (40 + 500 * aperture Hz, aperture 1 for a vowel) sits above u's 292 Hz F1, so the order-12 + // envelope reads that peak high (450 Hz); F2 is the second peak. var peaks = GesturePeaks("u"); if (peaks is null) return; - Assert.InRange(peaks[0], 876 * .9, 876 * 1.1); + Assert.InRange(peaks[1], 876 * .9, 876 * 1.1); } [Fact] @@ -302,7 +308,23 @@ public sealed class VocalTractFormantTests(ITestOutputHelper output) if (i is null || u is null || a is null) return; Assert.True(a[0] > i[0] + 250, $"F1 i {i[0]} a {a[0]}"); - // F2: i 2380 > a 1060 > u 840. - Assert.True(i[1] > a[1] + 800 && a[1] > u[0] + 100, $"F2 i {i[1]} a {a[1]} u {u[0]}"); + // F2: i 2380 > a 1060 > u 880. + Assert.True(i[1] > a[1] + 800 && a[1] > u[1] + 100, $"F2 i {i[1]} a {a[1]} u {u[1]}"); + } + + [Fact] + public void RoundedBackVowelIsAudibleNextToTheCloseFrontVowel() + { + // The rendered /ˈnibu/ had /u/ 29 dB under /i/: the gesture scaled the radiating aperture (an output gain) by the lip area + // the ladder already carries. Measured here: -4.3 dB; with the old aperture scale -22.7 dB. + var i = GestureWindow("i"); + var u = GestureWindow("u"); + if (i is null || u is null) return; + + var gap = 20 * Math.Log10(Rms(u) / Rms(i)); + var uPeaks = LpcPeaks(u); + output.WriteLine($"u rms {Rms(u):E2} i rms {Rms(i):E2} gap {gap:F1} dB; u peaks {string.Join(" ", uPeaks.Select(p => p.ToString("F0")))}"); + Assert.InRange(gap, -10, 3); + Assert.True(uPeaks[1] < 1000, $"u F2 {uPeaks[1]}"); } }