Skip to main content

Text-to-Speech

Text-to-speech systems turn any written text into human-sounding speech. They power many tools like voice assistants, spoken alerts, and more. Here we look at running TTS on Synaptics Astra.

note

This assumes you are familiar with setting up your Astra board. If not, please refer to the setup tutorial.

info

This quick guide is compatible with all SL16xx boards. While inference may vary, the steps remain the same across all Astra SL-Series processors.

Piper TTS Engine

Piper is a fast, on-device text-to-speech (TTS) model that is suitable for embedded devices, created by the Open Home Foundation. You can run a Python example to generate audio using the following command:

python3 -m text_to_speech.piper "synaptics astra example"

This command takes your text and generates a audio file in text_to_speech/output/speech-output-*.wav.

LISTENING TO THE AUDIO

To listen to the WAV file on your development machine, run in your Astra terminal:

python3 -m http.server -d text_to_speech/output/

And open a browser to the IP address of your board on your dev machine. Use CTRL + C to exit.

Internationalization

Piper supports many different languages. To select Mandarin Chinese you can do:

 python3 -m text_to_speech.piper "文本转语音支持多种语言" --voice zh_CN-huayan-medium