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.
You can find the text-to-speech functionality within the
cxcli tts subcommand. You can read the documentation about this command here.
cxcli tts command has a
synthesize subcommand. You can find the usage of this command here.
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 Cloud
Text-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.
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.
Here is a simple example of the
cxcli tts synthesize command:
cxcli tts synthesize hi --locale en-US --output-file hi.mp3
The above command will give you an audio file similar to the following:
You can download the audio file here.