Text-to-speech¶
cxcli
has some commands that allows you to interact with Google Cloud Text to Speech service using the Cloud Text-to-Speech API
!
Is this your first time using this feature?
Before you start using this functionality, please, read the authentication page.
Usage¶
You can find the text-to-speech commands usage down the cxcli tts
command. You can read the documentation about this command here.
The cxcli tts
root command has the synthesize
command. You can find the usage of this command here.
Parameters¶
These are the relevant parameters that you can use to interact with Google Cloud tts:
locale
: the locale accepts all the locales accepted by the GoogleCloud Text-to-speech API
. You can find all the locales available hereoutput-file
: mp3 file where we are going to write the synthesize text
Output¶
It is important to know that the output will have this format:
- A Sample Rate Hertz of 16000Hz
- The audio encoding will be Linear16. Linear16 is a 16-bit linear pulse-code modulation (PCM) encoding.
Example¶
This a simple example of the cxcli tts synthesize
command:
cxcli tts synthesize hi --locale en-US --output-file hi.mp3
The command above will give you an audio file like this one:
You can download the audio file here