TTS using Balacoon TTS light, REST API wrapper with FastAPI and Docker, for your text-to-speech needs on small device like raspberry-pi🤖
- run
./setup.shto download the modelen_us_hifi92_light_cpu.addon - To build image, run
docker build . --tag my/tts-api - To run image, run
docker run -d -p 7861:7861 -v ./audio:/code/audio -v ./model:/code/model --name tts-api my/tts-api⚠️ Note: Make sure to have the-vvolume parameter to avoid redownloading models. - Go to
http://127.0.0.1:7861/api/to check the app
- To convert text to speech, use the
POSTendpoint/api/tts/with payload of{message:"read this",name:"arnold",sample_rate:1.0}.messageis the text to be read andnameis the file name for th wav whilesample_ratecontrols the sampling rate. this returns the filename of the audio. - To read back converted speech, use the
GETendpoint/api/voice/with audio filename set a query paramsnamee.g..../api/voice?name=sample01.wav - All generated audio are saved in
audio/outputsfolder with the file name<sample>_<timestamp>. - Check
http://localhost:7861/docsfor OpenAPI documentation