Skip to main content

HTTP speech service

TTS_SERVICE=http asks a speech service with a small HTTP API, run by you or a partner, for the avatar's voice.

The API it expects​

POST {TTS_HTTP_URL}/v1/synthesize, JSON:

{ "text": "Buongiorno", "language": "it", "voice": null }
  • language is the two-letter language of the session.
  • voice is a voice id the service knows, or null for its default.

It answers 200 with a WAV (16-bit PCM, any sample rate). The API encodes it to mp3, the format every TTS provider hands to the kiosk. Any other status is an error.

Configure the API​

TTS_SERVICE=http
TTS_HTTP_URL=http://speech.example.org:8444
# the languages the service speaks: any other language fails
TTS_HTTP_LANGUAGES=it,en
# voice per language and gender, `<lang>[-<gender>]=<voice>`; empty = the service default
TTS_HTTP_VOICES=it-F=if_sara,it-M=im_nicola,en-F=af_heart,en-M=am_adam

TTS_HTTP_URL is the base URL, without the path. A session in a language outside TTS_HTTP_LANGUAGES gets no voice and the API logs the error: give that avatar another provider with its tts.provider (see Voice per avatar). An avatar's tts.model overrides the voice.