Text-to-Speech using Microsoft Speech API 4.0 (Microsoft Sam & friends)
Generate speech from text. Returns WAV audio data directly.
| Parameter | Type | Required | Description |
|---|---|---|---|
text | string | Yes | Text to synthesize |
voice | string | No | Voice name (e.g. "Adult Male #2") |
agent | string | No | ACS agent file (e.g. "Bonzi.acs") |
pitch | number | No | Voice pitch adjustment |
speed | number | No | Voice speed adjustment |
gain | number | No | Volume gain multiplier |
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
Health check endpoint.
{"status": "ok"}
List available SAPI4 voices.
List available ACS agent files.
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();