tts.google
Platypush documentation
tts.google
- class platypush.plugins.tts.google.TtsGooglePlugin(language: str = 'en-US', voice: Optional[str] = None, gender: str = 'FEMALE', credentials_file: str = '~/.credentials/platypush/google/platypush-tts.json', **kwargs)[source]
Bases:
TtsPlugin
Advanced text-to-speech engine that leverages the Google Cloud TTS API. See https://cloud.google.com/text-to-speech/docs/quickstart-client-libraries#client-libraries-install-python for how to enable the API on your account and get your credentials.
Requires:
google-cloud-texttospeech (
pip install google-cloud-texttospeech
)
- __init__(language: str = 'en-US', voice: Optional[str] = None, gender: str = 'FEMALE', credentials_file: str = '~/.credentials/platypush/google/platypush-tts.json', **kwargs)[source]
- Parameters:
language – Language code, see https://cloud.google.com/text-to-speech/docs/basics for supported languages
voice – Voice type, see https://cloud.google.com/text-to-speech/docs/basics for supported voices
gender – Voice gender (MALE, FEMALE or NEUTRAL)
credentials_file – Where your GCloud credentials for TTS are stored, see https://cloud.google.com/text-to-speech/docs/basics
kwargs – Extra arguments to be passed to the
platypush.plugins.tts.TtsPlugin
constructor.
- say(text: str, language: Optional[str] = None, voice: Optional[str] = None, gender: Optional[str] = None, player_args: Optional[dict] = None)[source]
Say a phrase.
- Parameters:
text – Text to say.
language – Language code override.
voice – Voice type override.
gender – Gender override.
player_args – Optional arguments that should be passed to the player plugin’s
platypush.plugins.media.MediaPlugin.play()
method.