From 5034ea7e4fefe557028588debbcede69ebafef38 Mon Sep 17 00:00:00 2001 From: Claude Date: Wed, 11 Nov 2026 03:21:32 +0000 Subject: [PATCH] macintalk: keep the release of b, d and g in the PlainTalk voices In Victoria high quality (and others) a b before r has no burst, only a quick start of voicing; stretching it with the rest of the sound made it a glide, and "brown" was heard as "own". The voiced stops are now put out as recorded, with their length made up in the closure. Word error rate over the test sentences: 17.9% to 17.0%. Co-Authored-By: Claude Opus 5.5 Claude-Session: https://claude.ai/code/session_01B82eRRAKCKq1gSHpownvFE --- docs/plaintalk-format.md | 4 +++- synth/macintalk/plaintalk.c | 27 ++++++++++++++++++++++++++- 2 files changed, 29 insertions(+), 2 deletions(-) diff --git a/docs/plaintalk-format.md b/docs/plaintalk-format.md index aa3c3c7..0b8cfcb 100644 --- a/docs/plaintalk-format.md +++ b/docs/plaintalk-format.md @@ -138,7 +138,9 @@ the phoneme before it and the first half of the diphone into the phoneme after it. That sound is changed to the length and pitch wanted with TD-PSOLA: each recorded period, in a window two periods wide, is placed at the spacing the pitch wants, and periods are repeated or dropped for the -length. A low-pass filter at 6 kHz takes off the hiss of the coding (2 +length. b, d and g are not stretched: their release is in some voices only +a quick start of voicing, which stretching turns into a glide, so they are +put out as recorded with silence added to (or cut from) the closure. A low-pass filter at 6 kHz takes off the hiss of the coding (2 bits a sample, 4 in high quality). For these voices the phrase ends slow down and fall less than for the MacInTalk 3 voices. The rest of the voice, Apple's rules for the timing and diff --git a/synth/macintalk/plaintalk.c b/synth/macintalk/plaintalk.c index d33e8ae..5f360c1 100644 --- a/synth/macintalk/plaintalk.c +++ b/synth/macintalk/plaintalk.c @@ -492,7 +492,7 @@ static float *pt_synth(struct ptvoice *v, int *nout) for (i = 0; i < nw; i++) { double want = wants[i], rate, t, end; - int k, l = i ? w[i - 1] : 0, r = i + 1 < nw ? w[i + 1] : 0, voiced; + int mid, k, l = i ? w[i - 1] : 0, r = i + 1 < nw ? w[i + 1] : 0, voiced; if (w[i] == 0) { /* a pause */ cur += want; continue; @@ -501,9 +501,34 @@ static float *pt_synth(struct ptvoice *v, int *nout) voiced = w[i] < 38; nsig = nmarks = 0; pt_half(v, 1, l, w[i], voiced); + mid = nsig; pt_half(v, 0, w[i], r, voiced); if (!nmarks) continue; + /* b, d, g: the middle is the closure, then comes the release, + * which in some voices is only a quick start of voicing with no + * burst. Stretching it would turn that into a glide ("brown" + * heard as "own"), so put the sound out as recorded and give the + * stop its length in the closure, adding silence or cutting some */ + if (w[i] >= 31 && w[i] <= 33) { + int len = (int)lrint(want), cut = 0, gap = 0, o = (int)lrint(cur), n; + if (len < nsig) + cut = nsig - len < mid ? nsig - len : mid; + else + gap = len - nsig; + for (j = 0, n = 0; j < nsig; j++) { + int oi; + if (j >= mid - cut && j < mid) + continue; + oi = o + n + (j >= mid ? gap : 0); + /* fade in over 2 ms, where the sound before rings out */ + if (oi >= 0 && oi < cap) + out[oi] += (float)(sig[j] * (n < 44 ? n / 44.0 : 1)); + n++; + } + cur += n + gap; + continue; + } /* TD-PSOLA: put out the recorded periods, each in a window two * periods wide, at the spacing the pitch wants, repeating or * dropping periods to give the phoneme its length */