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 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01B82eRRAKCKq1gSHpownvFE
7.3 KiB
PlainTalk voice files
What synth/macintalk knows about Apple's PlainTalk voices (MacinTalk Pro
1.5: Agnes, Bruce and Victoria, each in a standard and a high quality
version). It was worked out from the voices' data
alone: by reading the tables, decoding the sound and checking the result
by ear and with a speech recogniser. No Apple code was run, emulated,
disassembled or read to find it.
Where the files are
tools/fetch-macintalk.py downloads a Mac OS 8.6 hard disk image for the
SheepShaver emulator from the Internet Archive:
https://archive.org/details/MacOS8.6Image-SheepShaverEmulator, file
Mac OS 8.6 on disk image + SheepShaver.exe (SHA-256
003910efa3fc95a9c0da3f064e0e9aafafd9c2b20b11fde2e01d2f8fd9472c92). It is
a self-extracting RAR archive (RAR 2.9 compression), which unar or
unrar unpacks; the script takes only SheepShaver/Mac_OS_HD.dsk out of
it, a 500 MB HFS volume. The voices are in System Folder:Extensions: Voices, files of type ttvf and creator gala, with an empty data fork
and these resources:
| Resource | What it is |
|---|---|
gtss 3 "Engl…Data" |
the recorded sound and its tables (below) |
gtss 4 "Engl…Code" |
68k code: not extracted, not used |
ttvd |
the Speech Manager's VoiceDescription (name, gender, age) |
gtsv, gtsg, gtsm, gtsi |
small tables that tie the parts together |
vers, STR , ftag |
version 1.4.2, "English Text-To-Speech 1.5.3", © 1992-98 |
The script writes each voice's gtss 3 to <voice>.gtss (agnes.gtss,
bruce.gtss, victoria.gtss, and agnes-hq.gtss and so on for the files
called "Agnes, high quality" and so on).
The MacinTalk Pro extension itself holds the English text rules and
dictionary (gtst), the phoneme and allophone lists (gtsp, gtsa) and
the code (gtse). Only the allophone names in gtsa 2 were read, to name
the sounds below.
gtss 3
All big-endian. A 16-byte header, then twelve 32-bit offsets of sections 0 to 11 (from the start of the resource).
| Header word | Agnes, Bruce, Victoria | What it is |
|---|---|---|
| 0 | 50 | the number of wave-phonemes (the tables are 50 × 50) |
| 1, 2 | 100, 185, 125 (Victoria high quality: 70) | about the speaker's pitch period, samples at 22050 Hz; the median of the recorded periods (101, 191, 108) is better |
| 4 | 5739, 3922, 7804 | unknown |
| 7 | 0x0702, high quality 0x0403 | the coding |
| Section | Size (Agnes) | What it is |
|---|---|---|
| 0 | 20000 | first halves of the diphones: 2500 entries of 8 bytes, entry 50 × left + right |
| 1 | 20000 | second halves, the same way |
| 2 | 256668 | the voiced first halves (left sound 0 to 30) |
| 3 | 280676 | the voiced second halves (right sound 0 to 30) |
| 4 | 120688 | the consonant first halves (left sound 31 to 49) |
| 5 | 114716 | the consonant second halves |
| 6 | 19764 | period lengths of the units in section 2: 16-bit, each unit's list ends with 0xffff |
| 7 | 21668 | period lengths of the units in section 3 |
| 8 | 52 | a class for each wave-phoneme: 0, 1 (vowels and sonorants) or 2 (f, th, s, sh) |
| 9 | 172 | for each of the 86 allophones, its wave-phoneme and a second one (for ch, j and syllabic consonants) |
| 10 | 2048 | the codebook: 256 vectors of 4 signed 16-bit samples (high quality: 1024 bytes, 256 vectors of 2) |
| 11 | 352 | unknown (the same in every voice) |
The wave-phonemes
Section 9 maps the allophone names of gtsa 2 to these:
| 0, 1 | silence, breath |
| 2 to 22 | IY IH IX EH AE UX AX AA AO UH UW OW ER IR AR OR UR AY EY OY AW |
| 23 to 30 | syllabic l, l, m, n, N (ng), y, r, w |
| 31 to 37 | b d g v D z Z |
| 38 to 42 | f T s S h |
| 43 to 49 | p, p after s, t, t after s, glottal stop, k, k after s |
IR, AR, OR and UR are the vowels before r. Syllabic m and n are UX or UH plus m or n, ch is t plus sh and j is d plus zh.
The diphone tables
Entry left × 50 + right of section 0 says where the first half of the diphone left–right is (from the middle of left to the boundary), and the same entry of section 1 where its second half is (from the boundary to the middle of right). An entry is two 32-bit words:
0xffffffff, …: no such diphone.0x0000ffff, (l << 16) | r: use diphone l–r instead.- otherwise the unit's offset in its section divided by 4 (by 8 in the high quality voices; it can be more than 0xffff), then a second word: for a voiced unit a running count of the frames before it in its section, for a consonant unit the number of whole frames (high half) and a value up to about 120 (low half, unknown).
A half whose sound (the left one in section 0, the right one in section 1) is a consonant, wave-phoneme 31 or more, is in section 4 or 5; the others are in 2 or 3. Silence has no halves of its own.
A unit
Each unit starts on a 4-byte boundary (8 in high quality) with one byte (unknown, mostly 100 to 170), then frames. A unit is one stretch of sound at 22050 Hz, cut into frames of N samples; N is 96 for Agnes and Victoria and 160 for Bruce (it is not in the header; it is the frame size that makes all the units parse). The frames are not pitch periods, they simply follow each other.
| Bytes | |
|---|---|
| 1 | the gain A: a 4-bit exponent and 4-bit mantissa, gain = (16 + (A & 15)) × 2^(A >> 4) / 256. Its top bit is clear. |
| 1 | the lag B |
| N / 4 (high quality N / 2) | codebook indices |
Each sample is the sample one pitch period back, N + B − 1 samples earlier in the same unit, plus the gain times its sample of the codebook vector (one vector for each 4 samples, or 2). The first frame has nothing before it (low nibble 0 in A, and B = 1). In voiced sound N + B − 1 is the pitch period: it matches the recorded period lengths of sections 6 and 7 to within a sample or two. Lags of 50 and more turn up in noisy and changing frames; taking them as plain lags works.
The last frame is shorter: its first byte has the top bit set and its low 7 bits are its number of indices, then come the lag, the indices, the frame's gain byte, and padding to the next unit.
A voiced unit's samples add up to the sum of its period lengths in section 6 or 7 (give or take 3), so those lengths are its pitch marks. Consonant units have no list; the lags give the periods of the voiced ones.
How synth/macintalk uses it
The text front end, timing and pitch are the same as for the MacInTalk 3 voices. Each phoneme becomes a wave-phoneme (with the r-coloured vowels, and p, t, k after s; ch and j become two, t and sh, d and zh), and is made of the second half of the diphone from 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. 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 the pitch, is not used.
Not done
- The unit's first byte, header word 4 and section 11.