From 8d50819eace4fe1370312c8f6dd05b6f05f6f796 Mon Sep 17 00:00:00 2001 From: Aqua Date: Thu, 12 Nov 2026 22:48:02 +0000 Subject: [PATCH] Add /k/ to the IPA table: voiceless velar plosive Measured on /aka/: burst 0.45 of the vowel peak, burst spectral peak 3100 Hz (Chodroff and Wilson 2014: 2868 Hz; /t/ 3950 Hz by the same measure), burst only at its own release. Closure -14.9 dB re vowels against /p/ -20.4: NOT at or under /p/. The tract seals (glottal source off: -22.7 dB); the leak is the voicing the voiceless source still carries, and silencing it would change /p t/. Reported as unmet, with a regression bound in the test. Co-Authored-By: Claude Sonnet 5.5 --- .../articulatory-vocal-tract-sources.md | 1 + src/AquaSynth.Core/PatchScript.cs | 1 + .../StressAndReleaseRenderTests.cs | 106 ++++++++++++++++++ tests/AquaSynth.Dsl.Tests/WeksaPhonesTests.cs | 13 +++ 4 files changed, 121 insertions(+) diff --git a/docs/research/articulatory-vocal-tract-sources.md b/docs/research/articulatory-vocal-tract-sources.md index 6bc2d85..b184f94 100644 --- a/docs/research/articulatory-vocal-tract-sources.md +++ b/docs/research/articulatory-vocal-tract-sources.md @@ -148,6 +148,7 @@ Re-measure 2026-11-12 on main c0e6b98 (`tools/formant-check/weak_spots.py` over scaled by cell area over first-cell area (the ladder carries flow waves). /t/ 4008/6681 Hz, /d/ 4008/6693, /k/ 3747/9312 (peak 3747 without the floor too); /t/ is above /k/ by 261 Hz, short of the 2348 Hz of the corpus. Burst window peak /t/ 0.160, /k/ 0.148, /p/ 0.019; closure residue under 0.004. Unscaled, the injection made the closure 30 times louder (outside peak 0.058). /p/ and /b/ keep the glottal end and their Faust source byte for byte (`PlaceTableKeepsLabialAndAlveolarPositions`); their burst peak above 1 kHz is 7087 Hz, above /t/, and below 1 kHz it is a 434 Hz low resonance, not the place cue: the labial site is not moved. Below 1 kHz /t/ and /d/ peak at 480 Hz, the same low resonance. Unheard. - /t/ closure leak, 2026-11-12 (explicit descriptor, not in the table; /ata/ against /apa/ without burst, closure = 0.2 to 0.65 of the consonant, dB re the mean power of the flanking vowels): the alveolar closure was held at the nasal's 0.03 cm aperture and opened at 0.5, and read -14.3 dB against /p/ -22.1 (the lips seal /p/ whatever the tongue does); the same window with the aperture 0 for the whole gesture, -24.3. A non-labial plosive now holds aperture 0 to 0.65: -24.9 dB (test run) against /p/ -20.4. +- /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. - Phones the tract cannot make: `WordRender` refuses /t/, /d/, /k/, /l/ with exit 4 (`UNSUPPORTED PHONES (the tract has no gesture for them; nothing rendered): t`); the table holds p b 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. diff --git a/src/AquaSynth.Core/PatchScript.cs b/src/AquaSynth.Core/PatchScript.cs index ed3ea7b..e71b3b1 100644 --- a/src/AquaSynth.Core/PatchScript.cs +++ b/src/AquaSynth.Core/PatchScript.cs @@ -26,6 +26,7 @@ public static class PatchScript "p" => "voiceless_bilabial_plosive", "b" => "voiced_bilabial_plosive", "t" => "voiceless_alveolar_plosive", + "k" => "voiceless_velar_plosive", "m" => "voiced_bilabial_nasal", "n" => "voiced_alveolar_nasal", "s" => "voiceless_alveolar_fricative", diff --git a/tests/AquaSynth.Dsl.Tests/StressAndReleaseRenderTests.cs b/tests/AquaSynth.Dsl.Tests/StressAndReleaseRenderTests.cs index 6437c40..635b390 100644 --- a/tests/AquaSynth.Dsl.Tests/StressAndReleaseRenderTests.cs +++ b/tests/AquaSynth.Dsl.Tests/StressAndReleaseRenderTests.cs @@ -312,4 +312,110 @@ public sealed class StressAndReleaseRenderTests(ITestOutputHelper output) output.WriteLine($"/t/ burst spectral peak {peak:F0} Hz"); Assert.InRange(peak, 3500, 7000); } + + // /k/ over the /t/ tests: its own place (the velar distance in the place table), closure sealed by the tongue, burst under half the vowel. + // The spec asks /k/'s closure to be at or below /p/'s. It is not: with the voiceless source as /p/ and /t/ have it the closure reads + // -14.9 dB re the vowels (/p/ -20.4, /t/ -24.9). The tract itself seals: with the glottal source's flow scale held at 0 over the gesture the + // same closure reads -22.7 dB, under /p/; with the source on, the 150 Hz voicing is what reaches the output through a closure that leaves + // only a short rear cavity (the glottal pressure that the tract wall radiates is higher the smaller that cavity is). Silencing voicing in + // voiceless stops would change /p/ and /t/ (pinned byte for byte), so the criterion is reported as unmet (fork), not met by a /k/ special case. + // The second assertion is a regression bound on the measured leak, not the criterion. + [Fact] + public void AVelarStopClosureSealsAndItsLeakIsTheGlottalSource() + { + static SynthPatch WithoutSource(SynthPatch p) => + WithoutBurst(p) with + { + ControlSplines = WithoutBurst(p).ControlSplines + .Select(s => s.Name.StartsWith("w_1_c_source_level", StringComparison.Ordinal) + ? s with { Points = s.Points.Select(q => q with { Value = 0, OutValue = 0, InValue = 0 }).ToArray() } + : s).ToArray() + }; + + double Closure(string ipa, string descriptor, Func edit) + { + var (x, from, to) = VowelConsonantVowel(ipa, descriptor: descriptor, edit: edit); + if (x is null) return double.NaN; + var vowels = Math.Sqrt((Math.Pow(Rms(x, from - 0.08, from - 0.01), 2) + Math.Pow(Rms(x, to + 0.03, to + 0.12), 2)) / 2); + return 20 * Math.Log10(Rms(x, from + 0.2 * (to - from), from + 0.65 * (to - from)) / vowels); + } + + var p = Closure("p", "voiceless_bilabial_plosive", WithoutBurst); + var k = Closure("k", "voiceless_velar_plosive", WithoutBurst); + var kSilent = Closure("k", "voiceless_velar_plosive", WithoutSource); + output.WriteLine($"closure re vowels: /p/ {p:F1} dB, /k/ {k:F1} dB, /k/ with the glottal source off {kSilent:F1} dB"); + if (double.IsNaN(p)) return; + Assert.True(kSilent <= p, $"the /k/ closure seals: without the glottal source it is {kSilent:F1} dB, at or under /p/ ({p:F1} dB)"); + Assert.True(k <= -12, $"the /k/ closure with the source is {k:F1} dB (regression bound; the criterion, at or under /p/ {p:F1} dB, is not met)"); + } + + [Fact] + public void AVelarStopBurstStaysUnderHalfTheFollowingVowel() + { + var (x, from, to) = VowelConsonantVowel("k", descriptor: "voiceless_velar_plosive"); + var (nb, _, _) = VowelConsonantVowel("k", descriptor: "voiceless_velar_plosive", edit: WithoutBurst); + if (x is null || nb is null) return; + var burst = x.Zip(nb, (a, b) => a - b).ToArray(); + var peak = Peak(burst, from + 0.6 * (to - from), to + 0.01); + var vowel = Peak(x, to + 0.06, to + 0.17); + output.WriteLine($"/k/ burst peak {peak:F4}, vowel peak {vowel:F4}, ratio {peak / vowel:F2}"); + Assert.True(peak > 0.004, "audible"); + Assert.True(peak < vowel / 2, "under half the following vowel's peak, as /t/ and /b/"); + } + + [Fact] + public void VelarStopBurstExistsOnlyAroundItsOwnRelease_k() + { + IpaGestureExperimentTarget Phone(string label, string ipa, float seconds) => new($"w_{label}", ipa, "", seconds); + var script = IpaGestureExperiment.BuildWordScript( + [(Phone("0_n", "n", 0.095f), 1f), (Phone("1_a", "a", 0.18f), 1f), (Phone("2_k", "k", 0.095f), 1f), (Phone("3_a", "a", 0.18f), 1f), (Phone("4_n", "n", 0.095f), 1f)], 140); + var withBurst = Render(script, 0.77f); + var withoutBurst = Render(script, 0.77f, WithoutBurst); + if (withBurst is null || withoutBurst is null) return; + var burst = withBurst.Zip(withoutBurst, (x, y) => x - y).ToArray(); + const double kFrom = 0.275, kTo = 0.37; + var atRelease = Peak(burst, kFrom + 0.095 * 0.6, kTo + 0.02); + var leading = Peak(burst, 0, kFrom); + var trailing = Peak(burst, kTo + 0.12, 0.77); + output.WriteLine($"/k/ burst peak {atRelease:F4} at the release, {leading:F5} before the plosive, {trailing:F5} after it"); + Assert.True(atRelease > 0.004, "the burst is a transient of audible size"); + Assert.True(leading < atRelease / 20, "no burst before the plosive's own gesture"); + Assert.True(trailing < atRelease / 10, "no burst after the plosive"); + } + + // Chodroff and Wilson 2014: /k/ burst peak 2868 Hz. The band 2 to 4 kHz is a DESIGN tolerance around it, fixed before the first measurement. + // The peak is judged against the literature and against /t/ measured the same way (a velar burst enters further back, so its peak is lower). + // The centroid is reported, not asserted: over this 1 to 10 kHz grid /k/ reads 4626 Hz against /t/ 3629 Hz, higher though its peak is lower, + // because the /k/ burst has broadband energy above its peak, and no literature centroid for /k/ was retrieved to judge it by. + private (double Peak, double Centroid) BurstSpectrum(string ipa, string descriptor) + { + var (x, from, to) = VowelConsonantVowel(ipa, descriptor: descriptor); + var (nb, _, _) = VowelConsonantVowel(ipa, descriptor: descriptor, edit: WithoutBurst); + if (x is null || nb is null) return (double.NaN, double.NaN); + var start = (int)((from + 0.65 * (to - from)) * Rate); + const int n = 960; + var seg = Enumerable.Range(0, n).Select(i => (x[start + i] - nb[start + 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 a = 2 * Math.PI * hz * i / Rate; re += seg[i] * Math.Cos(a); im -= seg[i] * Math.Sin(a); } + return re * re + im * im; + } + + var grid = Enumerable.Range(0, 180).Select(k => 1000.0 + 50 * k).ToArray(); + var power = grid.Select(Power).ToArray(); + var smooth = power.Select((_, k) => Enumerable.Range(Math.Max(0, k - 4), Math.Min(9, power.Length - Math.Max(0, k - 4))).Average(j => power[j])).ToArray(); + return (grid[Array.IndexOf(smooth, smooth.Max())], grid.Zip(power, (f, w) => f * w).Sum() / power.Sum()); + } + + [Fact] + public void StopKBurstPeakIsInTheLiteratureBandAndLowerThanT() + { + var (peak, centroid) = BurstSpectrum("k", "voiceless_velar_plosive"); + if (double.IsNaN(peak)) return; + var (tPeak, tCentroid) = BurstSpectrum("t", "voiceless_alveolar_plosive"); + output.WriteLine($"/k/ burst spectral peak {peak:F0} Hz, centroid {centroid:F0} Hz; /t/ peak {tPeak:F0} Hz, centroid {tCentroid:F0} Hz"); + Assert.InRange(peak, 2000, 4000); + Assert.True(peak < tPeak, $"/k/ peak {peak:F0} Hz is under /t/ {tPeak:F0} Hz"); + } } diff --git a/tests/AquaSynth.Dsl.Tests/WeksaPhonesTests.cs b/tests/AquaSynth.Dsl.Tests/WeksaPhonesTests.cs index 5bf8e32..a1b42f8 100644 --- a/tests/AquaSynth.Dsl.Tests/WeksaPhonesTests.cs +++ b/tests/AquaSynth.Dsl.Tests/WeksaPhonesTests.cs @@ -82,6 +82,19 @@ public sealed class WeksaPhonesTests Assert.Contains(patch.ControlSplines, s => s.SurfacePath == "/vocal/contacts/0/release_flow" && s.Name.StartsWith("ata_1_t", StringComparison.Ordinal)); } + [Fact] + public void WeksaWordPlanAcceptsK() + { + var word = WeksaPhonesReader.Parse(Line($"[{Ph("ɑ", "none")},{Ph("k", "none")},{Ph("ɑ", "none")}]")); + var plan = WeksaWordPlan.From(word, "aka"); + Assert.True(plan.Renderable, string.Join(",", plan.Unsupported.Select(p => p.Ipa))); + Assert.Empty(plan.Unsupported); + Assert.True(PatchScript.TryIpaDescriptor("k", out var descriptor)); + Assert.Equal("voiceless_velar_plosive", descriptor); + var patch = PatchScript.Parse(IpaGestureExperiment.BuildWordScript(plan.Phones.ToArray(), 140)); + Assert.Contains(patch.ControlSplines, s => s.SurfacePath == "/vocal/contacts/0/release_flow" && s.Name.StartsWith("aka_1_k", StringComparison.Ordinal)); + } + [Fact] public void NearCloseVowelsRenderAsVowelsWithTheirOwnStoryShape() {