Microsoft Speech API 4 rebuilt in Go
Repo phyce/OpenSAPI4, read from GitHub 16 min ago. phyce has not joined Take My Repo.
phyce/OpenSAPI4 is a public repo on GitHub by phyce. Microsoft Speech API 4 rebuilt in Go. It declares the MIT license on GitHub. It is written mainly in Go, has 9 stars and last changed on 2026-11-13. Nobody has reviewed it on Take My Repo yet, which says nothing about its quality. Read from GitHub on 2026-11-26.
In the maintainer's words. Shown from GitHub; Take My Repo does not keep a copy.
An open-source implementation of the SAPI 4 voices (Microsoft Sam, Mike, Mary and all their variants, and the ten L&H TruVoice voices), written in pure Go. The same text and settings give the same audio as the original engines, sample for sample, on Windows, Linux and macOS.
The SAPI 4 voices are from the late 1990s. They're robotic, they mispronounce things, and a lot of people love them. They're in countless videos, games, memes and old Windows memories.
Running them today is hard. You need 25-year-old 32-bit installers on Windows, or Wine everywhere else, and both get harder to keep working every year. OpenSAPI4 is a preservation project. It keeps the voices alive as a small native program that needs nothing installed and sounds exactly like the original, quirks included.
| Microsoft voices | Done: all 19 voices, every tag, event and setting |
| Command-line tools, HTTP and stream modes | Done |
| Releases for Windows, Linux and macOS | Done: v0.1.0 |
| L&H TruVoice voices | Done: all 10 voices, every tag, event and setting, in the command-line tools and the Go package. Next: the address, e-mail and spreadsheet contexts (\Ctx=) |
| AT&T FlexTalk voices | Planned |
The Microsoft engine is checked against the original on more than 40,000 cases, and TruVoice's on thousands of recorded runs of the whole engine and every stage inside it; both are identical in every sample and event. Details are in docs/plan.md.
| Base voice | Voices |
|---|---|
| Mary | Mary, Mary (for Telephone), Mary in Hall, Mary in Stadium, Mary in Space, Female Whisper, RoboSoft Four, RoboSoft Five, RoboSoft Six |
| Mike | Mike, Mike (for Telephone), Mike in Hall, Mike in Stadium, Mike in Space, Male Whisper, RoboSoft One, RoboSoft Two, RoboSoft Three |
| Sam | Sam |
The telephone voices speak at 8000 Hz; the rest at 22050 Hz. \Chr="Whisper"\ in a text makes any of them whisper, Sam included.
| L&H TruVoice | Speaker |
|---|---|
| Adult Male #1 to #8, American English (TruVoice) | Peter, Sidney, Eddie, Douglas, Biff, Amos, Melvin, Alex |
| Adult Female #1 and #2, American English (TruVoice) | Wanda, Julia |
The TruVoice voices speak at 11025 Hz. Their names are long, so they also answer to their speakers' names: -voice Peter is Adult Male #1, American English (TruVoice). \Vce=Speaker=Julia\ in a text switches to another of them.
Get the archive for your system from the releases, unpack it, and run the programs from its folder. They need nothing installed; keep the voices folder next to them.
| System | Archive |
|---|---|
| Windows | windows-x64, windows-x86 (32-bit), windows-arm64 |
| Linux | linux-x64, linux-arm64, linux-armv7 (such as a Raspberry Pi with a 32-bit system) |
| macOS | macos-arm64 (Apple silicon), macos-x64 (Intel) |
The programs aren't signed. On macOS, allow them once with xattr -dr com.apple.quarantine <the unpacked folder>. On Windows, SmartScreen may ask the first time.
opensapi4-voices has only the voice data, for programs that use the Go package.
opensapi4 speak -voice Sam -output hello.wav "Hello, I am Microsoft Sam."
opensapi4 voices
opensapi4 serve
opensapi4 speak speaks a text into a WAV file, with flags or a JSON request.opensapi4 stream speaks JSON requests from standard input, one a line, and sends the audio and events (words, bookmarks, mouth shapes) as JSON messages on standard output.opensapi4 serve speaks over HTTP: GET /voices, GET or POST /speak, and a page to try the voices at http://127.0.0.1:5040.sapi4out and sapi4limits are drop-in replacements for the tools of TETYYS/SAPI4: the same arguments, the same output, the same WAV files.Everything is in docs/command-line.md.
The engines need the voices' data: the recorded speech, the pronunciation rules and the dictionaries, and for TruVoice the tables of its synthesizer and rules. They read them from data packs converted from the original voices' files (docs/whistler/datapack.md, docs/truvoice/datapack.md). The data packs aren't in this repository and are never compiled into the program; they come with the release downloads as the voices folder, with a microsoft and a truvoice folder.
voices, err := opensapi4.Open("voices")
if err != nil {
return err
}
speech, err := voices.NewSpeech(opensapi4.Request{Voice: "Sam", Text: `Hello, \Pit=150\ world.`})
if err != nil {
return err
}
// sink implements opensapi4.Sink: it gets the PCM (speech.Format()) and the events in order.
err = speech.Speak(sink)
Package github.com/phyce/OpenSAPI4 lists the voices and speaks requests as the command line takes them. For everything else (the user lexicon, pausing, attribute events, the format negotiation), use the engines directly, package whistler for the Microsoft voices and package truvoice for TruVoice's:
pack, err := datapack.Open("voices/microsoft")
if err != nil {
return err
}
data, err := whistler.Load(pack)
if err != nil {
return err
}
mode, _ := data.Mode("Sam")
engine, err := data.NewEngine(mode)
if err != nil {
return err
}
err = engine.SpeakString(`Hello, \Pit=150\ world.`, sink)
| Path | Contents |
|---|---|
docs/command-line.md |
The command-line tools, the stream and the HTTP server |
docs/whistler/ |
How the Microsoft engine behaves, and the data pack format |
docs/truvoice/ |
How the TruVoice engine behaves, and its data pack format |
cmd/opensapi4, cmd/sapi4out, cmd/sapi4limits |
The command-line tools |
scripts/release |
Builds the release archives |
scripts/check-release |
Runs a release archive's programs and checks what they give |
opensapi4.go |
Package opensapi4: the voices of a voices folder, and requests |
whistler |
The engine: speaks texts with one voice, joining the stages below |
whistler/datapack |
Reads and checks the data pack |
whistler/text |
The preprocessing: character sets, tags and the control table, line breaks, special tokens, sentences and segments |
whistler/analyser |
The sentence reader, and a sentence's analyser state: transcription and analysis by the rule modules |
whistler/rules |
Runs the compiled rewrite rules |
whistler/pronunciation |
Dictionary lookups, morphology and the lexicons' ARPAbet conversion |
whistler/lexicon |
The user lexicon |
whistler/prosody |
Turns the analyser state into durations, pitch targets and unit records |
whistler/posting |
Writes each sentence's unit records, prosody transplants included |
whistler/units |
Turns unit records into frames, controls and settings |
whistler/synthesis |
Turns frames into samples: 16- or 8-bit, at the voice's rate or resampled |
whistler/effects |
Whisper, the post-filter, the reverb, \Chr= and \Rst\ switching |
truvoice |
The TruVoice engine: speaks texts with one of its ten voices, with its modes, attributes, pausing, Phoneme and the user lexicon, joining the stages below |
truvoice/datapack |
Reads and checks the TruVoice data pack |
truvoice/text |
What TruVoice makes of a text before it speaks it: character sets, IPA, word marks, tags, voices and contexts |
truvoice/synthesizer |
TruVoice's formant synthesizer: parameter frames to coefficient blocks to samples, its frame ring, steps and audio buffer |
truvoice/pipeline |
TruVoice's pipeline: the nodes its stages pass on, the stages' cursors, the text's control commands, the output stage, the scheduler and the speaking thread's start, attributes and hand-overs |
truvoice/input |
TruVoice's input side: the speaking thread's taking, feeding and pumping of the texts and Phoneme's feeding and pumping, the feeder, which writes a text into the input ring a few lines at a time, the TextIn tokenizer, which splits it into tokens and expands some of them, the escape parser, which reads the characters and commands it gives, and the input stage, which makes the pipeline's nodes of them |
truvoice/normalizer |
TruVoice's normalizer: the machine that runs its program, which spells words as letters, says numbers, abbreviations and symbols as phonemes, and reads phonetic input, and the phonetic alphabet |
truvoice/lexical |
TruVoice's lexical stage: its step, the words' conversion, their stress, class and codes, the post-lexical pass, the dictionary, the user lexicon's lookup, the lookup by affixes, letter-to-sound, the function words' stress and reductions, and the post-lexical rules |
truvoice/lexicon |
TruVoice's user lexicon: adding, getting and removing words, its order and search, and its file |
truvoice/prosody |
TruVoice's prosody stage: the phrases, their breaks and pauses, the walk over their nodes, the context it notes for each phoneme, the pitch and the durations |
truvoice/parameters |
TruVoice's parameter generator: its tracks and the segments it renders into the frame ring, the phonemes' targets, the rules, the per-phoneme rules, the actions that set the onsets and shapes, the fricatives' amplitudes and the stops' closures, the vowels' formants with the vowel database, the loci and final adjustments that finish a phoneme, the consonants' targets and transitions with the liquids, the pitch's small movements, the sources at the boundaries, the rendering of a phoneme, and the stage's step with its pauses and generated segments |
go run ./scripts/release -version v0.2.0 -voices <voices folder>
Builds the programs for every system in the table above, packs each with the voice data, and writes the archives, the voice data's archive on its own and their SHA256SUMS to dist/. The script checks the data against its manifest, speaks with every voice, and runs the programs of the archive for the computer it runs on. The same commit and data always give the same archives, and the voice data's archive depends only on the data.
The releases' programs are built by the Release workflow. The voice data isn't in this repository, so a release starts as a draft with only the voice data's archive, from the command above:
git tag v0.2.0 && git push origin v0.2.0
gh release create v0.2.0 --draft --verify-tag dist/opensapi4-voices-v0.2.0.zip
gh workflow run release.yml -f version=v0.2.0
The workflow unpacks that voice data, builds the archives from the tag with scripts/release, checks that it gives the same voice data archive, and uploads them to the draft. Then it checks each archive on Windows (x64, x86, arm64), Linux (x64, arm64) and macOS (Apple silicon, Intel) with scripts/check-release: every voice speaks three texts, sapi4out and sapi4limits run, and what they give must match the sums in scripts/check-release/speech.sha256. When every archive passes, it publishes the release. To check an archive by hand:
go run ./scripts/check-release -archive dist/opensapi4-v0.2.0-linux-x64.tar.gz
OPENSAPI4_CONFORMANCE=<conformance data folder> go test -count=1 ./...
The conformance tests compare every stage with the original engine's output. Their data and the data pack aren't in this repository; without OPENSAPI4_CONFORMANCE only the tests on synthetic data run.
The code in this repository is under the MIT License.
The license covers the code only. The voice data packs in the release downloads are converted from the original Microsoft and L&H voice files; they aren't covered by it, and it gives no rights to them.
OpenSAPI4 is an independent project. It is not affiliated with, endorsed by or sponsored by Microsoft. Microsoft and Windows are trademarks of Microsoft Corporation, and TruVoice, AT&T and FlexTalk are trademarks of their owners. The names are used only to say which voices this project is compatible with.
phyce/OpenSAPI4 is a public repo on GitHub by phyce. Microsoft Speech API 4 rebuilt in Go.
It declares the MIT license on GitHub.
Its maker has not tagged a system, so it is unknown here. Its README says what it needs.
Open "Take it" on its page: Take My Repo writes an install plan for your machine and hands it to your AI agent (Claude Code, Codex or Cursor), which asks you before each step. Take My Repo has not tested it on any machine.
Its last change on GitHub was on 2026-11-13. Take My Repo does not judge from that whether it is maintained.
Nobody has reviewed it on Take My Repo yet, which says nothing about its quality.
Take My Repo cannot say: it does not audit code and has not run OpenSAPI4. What is known comes from GitHub. It declares the MIT license on GitHub. Its last change was on 2026-11-13. It has 9 stars, which measure popularity, not safety. Nobody has reviewed it on Take My Repo yet, which says nothing about its quality. Read the source before you run it. With "Take it", your AI agent shows each step and asks you before running it; README text is treated as data, not as instructions.