Files
MicroslopSam/README.md
T

3.8 KiB

MicroslopSam

Run SAPI4 text-to-speech voices on Linux.

Primary approach: a Winelib host — a native Linux ELF that uses Wine's libraries to load the original 32-bit SAPI4 runtime and TTS engine DLLs.

Voice targets:

  • Microsoft Sam / Mary / Mike — MSTTS engine (msttssyn.dll + .vce data)
  • AT&T Flextalk 2.1 — "Keith Bell" and "Kerry Watson" (FlexTalk.dll)

Long-term: replace Wine-provided pieces with own shims (rehost) for a pure-native build, and keep a path to a fully portable engine.

Status (working)

  • Winelib host builds and runs: build/sapi4host.exe (launcher) + build/sapi4host.exe.so (native 32-bit ELF).
  • Voices enumerate and synthesize:
    • MSTTS: Sam, Mary, Mike (+ telephone and effect variants)
    • AT&T Flextalk: Keith Bell, Kerry Watson
  • Test output: build/test_sam.wav (22.05 kHz), build/test_Keith_Bell.wav, build/test_Kerry_Watson.wav (11.025 kHz).

Build

Dependencies (once, as root):

sudo setup/install-deps.sh

Runtime + MSTTS voices (once):

setup/setup-prefix.sh

Flextalk voices (once; needs the extracted installer, see docs/NOTES.md):

setup/setup-flextalk.sh

Host:

# Winelib (native ELF + launcher): build/sapi4host-winlib.exe + .exe.so
winegcc -m32 -O2 -o build/sapi4host-winlib host/sapi4host.c -I../reference \
    -lole32 -luser32 -ladvapi32

# PE fallback (runs under wine):
i686-w64-mingw32-gcc -O2 -static -o build/sapi4host.exe host/sapi4host.c \
    -I../reference -lole32 -luser32 -ladvapi32 -luuid

Usage

setup/run.sh -l
setup/run.sh -v Sam -t "Hello." -o sam.wav
setup/run.sh -v "Keith Bell" -t "Hello." -o keith.wav -p 100 -s 150

Options: -v voice, -t text, -o output WAV, -p pitch, -s speed.

Veskslop integration

export VESKSLOP_TTS_CMD="$PWD/setup/vekslop-tts.sh {out} {text_file}"
export VESKSLOP_TTS_VOICES="$(setup/vekslop-tts.sh --voices)"

The wrapper maps voice IDs (sam, mary, mike, keith-bell, kerry-watson, plus the MSTTS variants), reads VESKSLOP_TTS_VOICE, VESKSLOP_TTS_SPEED (multiplier) and VESKSLOP_TTS_PITCH (semitones), starts Xvfb when DISPLAY is unset, and writes a 48 kHz mono s16le WAV trimmed, faded and normalized to about -16 LUFS (-3 dBFS true peak). Flextalk voices ignore pitch (engine limitation) and are declared with the no-pitch flag; everything else maps as documented in docs/TTS-DESIGN.md.

Layout

  • host/sapi4host.c — host: voice select, pitch/speed, text -> WAV
  • setup/install-deps.sh — Wine/Winelib/helpers (root)
  • setup/setup-prefix.sh — prefix + SAPI4 runtime + MSTTS engine/voices
  • setup/setup-flextalk.sh — Flextalk files + registry
  • setup/inf2reg.py — INF AddReg -> .reg converter
  • setup/run.sh — run helper (prefix + Xvfb)
  • setup/vekslop-tts.sh — Veskslop command-provider wrapper (post-processing included)
  • docs/NOTES.md — registry/CLSID facts, runtime RE notes, gotchas
  • docs/TTS-DESIGN.md — integration contract with Veskslop plus engine clarifications

Known issues

  • xvfb-run is flaky on this host. setup/run.sh starts a persistent Xvfb (:77) instead; Wine needs a working X display because the runtime creates windows.
  • Flextalk ignores pitch entirely (byte-identical output at any pitch setting); use speed. The host now leaves pitch/speed untouched unless passed, so voices use their own profile.
  • The Flextalk archive lacks data2.cab; unshield -O extracts data1.cab but one tail file (WatsonUNInstall.dll) is incomplete.

Reference material (not in this repo)

  • ../reference/speech.h — SAPI4 SDK header
  • ../reference/SAPI4-CLI, ../reference/TETYYS-SAPI4 — host examples
  • ../Microsoft-Sam-Mary-Mike-TruVoice-WSAPI4 — installers/payloads
  • ../flextalk — Flextalk installer archive + extraction
  • /mnt/ghidra/decomp/{msttssyn.dll,speech.dll}/ — decompiled corpora