mirror of
https://github.com/D-Modem/speaking-clock.git
synced 2026-11-28 20:48:04 -08:00
Measured against Sam's own recordings of the clock's phrases, our Sam was 3-6 dB too dark above 2.5 kHz (Mike and Mary were not). A linear-phase correction for Sam only brings it within about 1 dB. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01B82eRVXG9MBYPxmcs9cFxs
mssam
Our own synthesiser for the Microsoft Sam, Mike and Mary voices (Microsoft
Speech API 4, 1998). It reads the voices' data and speaks with it. No
Microsoft code is used or run, and none of Microsoft's files are in this
repository: tools/fetch-mssam.py downloads Microsoft's package at build
time and keeps only the voice data.
make # build mssam
make voices # fetch the voice data into ../../sources/mssam (8 MB download, needs cabextract or 7z)
make test # speak a sentence with each voice
sudo make install # /usr/local/bin/mssam and /usr/local/share/mssam
mssam [-d DIR] [-v sam|mike|mary|mike-tel|mary-tel] [-r RATE] [-p PITCH] [-o OUT.wav] TEXT...
mike-tel and mary-tel are Microsoft's 8 kHz voices made for phone
lines. -d is the folder with the voice data (default /usr/local/share/mssam,
or $MSSAM_DIR). -r and -p multiply the speed and pitch. Without -o
the WAV (22050 Hz, or 8000 Hz for the telephone voices, 16-bit mono) goes to standard output.
How it speaks
- The text becomes words (numbers and times like
11:05are spelled out,a.m.is two letters), and the words become sounds from the CMU Pronouncing Dictionary: the clock's own words are built in (lexicon.h), andcmudict.dictin the voice folder covers the rest. Unknown words are spelled. - Each sound gets one of the voice's recorded units. The voice has a decision tree for each sound, whose questions are about the sounds either side and where the sound is in its word; the leaf it reaches is the unit.
- Each unit is a run of frames: a 20th-order spectrum (line spectral frequencies) and a gain, with a pitch pulse for voiced frames and noise for the others. The frames are played through the filter at a new pace and with a new pitch. Each phrase starts near 100 Hz, the first stressed word rises above it, and the phrase sinks to about 73 Hz at its end, the shape measured from Sam's own recordings (Mike and Mary are scaled to their own pitch, from their tone tables). The spectrum glides from frame to frame, the loudness of a unit's first frames leans toward the unit before it, each pitch pulse is blended with the one before (the stored pulses are rougher than Sam's speech), the gap between loud vowels and quiet consonants is narrowed a little, and a treble lift restores the brightness of the original recordings. Sam also gets a tone correction, because his units come out darker above 2.5 kHz than his own voice.
docs/mssam-format.md describes the voice data.