# DECTalk TTS Server A standalone HTTP server that turns text into speech using authentic DECTalk (the Moonbase Alpha voice). It exposes both a simple GET endpoint and a MiniMax-compatible POST endpoint, so it can be used directly or as a drop-in TTS backend. This service was extracted from the ttstoy Discord bot cog so it can run on its own as a system service, independent of the bot. ## Requirements - Node.js (v16 or newer recommended) - ffmpeg (used to encode output to mp3) - npm dependencies: `express`, `dectalk` (installed via `npm install`) Install ffmpeg on Debian/Ubuntu: ```bash sudo apt install ffmpeg ``` ## Running ```bash ./start.sh ``` `start.sh` runs `npm install` on first launch and then starts the server. The listening port defaults to `33001` and can be overridden with the `PORT` environment variable. You can also run it directly: ```bash npm install PORT=33001 node server.js ``` ## API ### GET /say Generate speech and return an mp3. ``` GET /say?text=Hello%20world ``` Response: `audio/mpeg` (mp3 bytes). Voice is controlled inline using DECTalk voice commands (see below). ### POST /v1/t2a_v2 MiniMax-compatible endpoint. Accepts JSON `{ "text": "..." }` and returns a JSON body with the audio encoded as hex under `data.audio`. ```bash curl -X POST http://127.0.0.1:33001/v1/t2a_v2 \ -H 'Content-Type: application/json' \ -d '{"text":"Hello from DECTalk"}' ``` ### GET /voices Returns the list of available DECTalk voices and their inline command codes. ### GET /engine Returns engine type and version metadata. ### GET /health Returns `{ "status": "ok" }`. ## Voice commands Voices are selected inline by prefixing the text with a command code: | Voice | Command | Description | |--------|---------|-------------------------| | Paul | `[:np]` | Perfect Paul (default) | | Betty | `[:nb]` | Beautiful Betty | | Harry | `[:nh]` | Huge Harry (deep male) | | Frank | `[:nf]` | Frail Frank (elderly) | | Dennis | `[:nd]` | Doctor Dennis | | Kit | `[:nk]` | Kit the Kid (child) | | Ursula | `[:nu]` | Uppity Ursula | | Rita | `[:nr]` | Rough Rita | | Wendy | `[:nw]` | Whispering Wendy (soft) | Example: ``` GET /say?text=[:nh]This is Huge Harry speaking. ``` ## Running as a system service A systemd unit file is provided (`dectalk-tts-server.service`). See INSTALL.md for setup steps.