SAPI4 TTS API

Text-to-Speech using Microsoft Speech API 4.0 (Microsoft Sam & friends)

Try It

Endpoints

POST /api/synthesize

Generate speech from text. Returns WAV audio data directly.

Request Body (JSON)

ParameterTypeRequiredDescription
textstringYesText to synthesize
voicestringNoVoice name (e.g. "Adult Male #2")
agentstringNoACS agent file (e.g. "Bonzi.acs")
pitchnumberNoVoice pitch adjustment
speednumberNoVoice speed adjustment
gainnumberNoVolume gain multiplier

Example

curl -X POST https://tts.ell.dev/api/synthesize \
  -H "Content-Type: application/json" \
  -d '{"text": "Hello world", "voice": "Adult Male #1"}' \
  --output hello.wav
GET /api/health

Health check endpoint.

Response

{"status": "ok"}
GET /api/voices

List available SAPI4 voices.

GET /api/agents

List available ACS agent files.

JavaScript Example

const response = await fetch('/api/synthesize', {
  method: 'POST',
  headers: { 'Content-Type': 'application/json' },
  body: JSON.stringify({ text: 'Hello world', agent: 'Bonzi.acs' })
});

const audioBlob = await response.blob();
const audioUrl = URL.createObjectURL(audioBlob);
const audio = new Audio(audioUrl);
audio.play();