Introduction
This service supports voice-based interaction. The text_to_speech
service enables the use of the Google Text-to-Speech platform within your application. It artificially produces human speech from text. It can also be used in combination with social robots to replace the robot’s own ('onboard') speech synthesis capabilities.
Docker name: text_to_speech
Input
sensors: none
actuators: none
parameters:
text:
value: text to synthesise
type: string
Initial (One-Time) Setup
Download the keyfile JSON from the TTS Google Agent
Note: the JSON file can be changed in the application at runtime using the
TTSConnector
'sset_tts_key(<path to keyfile>)
method
Choose a voice ID for the text synthesising from here
the language is automatically inferred from the voice ID
Note: the voice can be changed in the application at runtime using the
TTSConnector
'sset_tts_voice(<voice ID>)
method
Output
sensors: none
actuators: speakers
data:
value: synthesised text as speech
type: bytestream
Service Configuration
In order to use the service, you first need to create a TTS Agent. For that, visit this page to set up a Google service account and download the JSON keyfile.
...
You should now be able to use the TTS Google Agent.
Usage
Regular Usage
Create a
TTSConnector
instance.set the keyfile and the voice ID in the
TTSConnector
call the connector’s
say_text_to_speech([text])
with the text to be synthesized
Example
See this for an example usage.
Events
PlayAudioDone
is raised when the speech synthesis is done. The event can be listened to
Known Issues
Google’s TTS has no limitations on the number of characters. However, depending on your subscription plan, there is a limit on the monthly number of spoken characters.
...