Text-to-speech¶
The cxcli
tool has various commands that allow you to interact with Google Cloud's 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 functionality within the cxcli tts
subcommand. You can read the documentation about this command here.
The cxcli tts
command has a synthesize
subcommand. 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
: this parameter accepts all of the locales that are available in the Google CloudText-to-speech API
. You can find all the locales available here.output-file
: MP3 audio file where we are going to output the synthesized text.
Output¶
It is important to know that the output audio will have the following format:
- A sample rate of 16000 Hertz
- The audio encoding will be Linear16. Linear16 is a 16-bit linear pulse-code modulation (PCM) encoding.
Example¶
Here is a simple example of the cxcli tts synthesize
command:
The above command will give you an audio file similar to the following:
You can download the audio file here.