aiy.voice.tts¶
An API that performs text-to-speech.
You can also use this to perform text-to-speech from the command line:
python ~/AIY-projects-python/src/aiy/voice/tts.py "hello world"
-
aiy.voice.tts.
say
(text, lang='en-US', volume=60, pitch=130, speed=100, device='default')¶ Speaks the provided text.
Parameters: - text – The text you want to speak.
- lang – The language to use. Supported languages are: en-US, en-GB, de-DE, es-ES, fr-FR, it-IT.
- volume – Volume level for the converted audio. The normal volume level is
100. Valid volume levels are between 0 (no audible output) and 500 (increasing the
volume by a factor of 5). Values higher than 100 might result in degraded signal
quality due to saturation effects (clipping) and is not recommended. To instead adjust
the volume output of your device, enter
alsamixer
at the command line. - pitch – The pitch level for the voice. The normal pitch level is 100, the allowed values lie between 50 (one octave lower) and 200 (one octave higher).
- speed – The speed of the voice. The normal speed level is 100, the allowed values lie between 20 (slowing down by a factor of 5) and 500 (speeding up by a factor of 5).
- device – The PCM device name. Leave as
default
to use the default ALSA soundcard.