##Using the FT Labs text-to-speech service as an API
The FT Labs TTS Dash was not designed to be used as an API, however it can function as such. This document outlines the requests that can be made to the FT Labs Dash in order to synthesise speech from text with Amazon’s Polly service.
npm install
touch .env
- Run
touch .env
to create the required .env file - Open your new .env file and add the following variables:
PORT=3009 BASE_URL=http://localhost:3009 OKTA_CLIENT= OKTA_ISSUER= OKTA_SECRET= SESSION_TOKEN=
- Get
SESSION_TOKEN
from LastPass - Get details for finding
OKTA_ISSUER
,OKTA_CLIENT
&OKTA_SECRET
in LastPass
npm start
The request must have the following headers set:
Content-Type: application/json
The body of the request must be a JSON object with the following keys/value pairs:
{ “content” : “The text you wish to have synthesised”, "voice" : "Geraint (Welsh English)" }
A token must be passed as the query parameter token with the request. This is available in the shared FT Labs LastPass folder.
curl -H "Content-Type: application/json" -X POST -d '{"content" : "hello","voice" : "Geraint (Welsh English)"}' https://ftlabs-tts-dash.herokuapp.com/service/polly?token=[TOKEN] > temp.mp3
The Amazon Poly service has a number of voices that can be used to select text. You can specify which voice to use with voice param in the POST request to /service/polly.
The following list is the values you must pass to you each voice:
- Geraint (Welsh English)
- Gwyneth (Welsh)
- Hans (German)
- Marlene (German)
- Nicole (Australian)
- Russell (Australian)
- Amy (British)
- Brian (British)
- Emma (British)
- Raveena (Indian English)
- Ivy (US)
- Joanna (US)
- Joey (US)
- Justin (US)
- Kendra (US)
- Kimberly (US)
- Salli (US)
- Celine (French)
- Mathieu (French)
The case must be respected.