Google Cloud Text to Speech Operators¶
Prerequisite Tasks¶
CloudTextToSpeechSynthesizeOperator¶
Synthesizes text to audio file and stores it to Google Cloud Storage
For parameter definition, take a look at
CloudTextToSpeechSynthesizeOperator
Arguments¶
The input
, voice
and audio_config
arguments need to be dicts or objects of corresponding classes from
google.cloud.texttospeech_v1.types
module
for more information, see: https://googleapis.github.io/google-cloud-python/latest/texttospeech/gapic/v1/api.html#google.cloud.texttospeech_v1.TextToSpeechClient.synthesize_speech
The filename
argument is a simple string argument:
Using the operator¶
text_to_speech_synthesize_task = CloudTextToSpeechSynthesizeOperator(
project_id=GCP_PROJECT_ID,
input_data=INPUT,
voice=VOICE,
audio_config=AUDIO_CONFIG,
target_bucket_name=BUCKET_NAME,
target_filename=FILENAME,
task_id="text_to_speech_synthesize_task",
)
text_to_speech_synthesize_task2 = CloudTextToSpeechSynthesizeOperator(
input_data=INPUT,
voice=VOICE,
audio_config=AUDIO_CONFIG,
target_bucket_name=BUCKET_NAME,
target_filename=FILENAME,
task_id="text_to_speech_synthesize_task2",
)