This notebook shows how to interact with the
Google Cloud Text-to-Speech API to achieve speech synthesis
First, you need to set up an Google Cloud project. You can follow the instructions here.
# !pip install google-cloud-text-to-speech
from langchain.tools import GoogleCloudTextToSpeechTool
text_to_speak = "Hello world!"
tts = GoogleCloudTextToSpeechTool()
We can generate audio, save it to the temporary file and then play it.
speech_file = tts.run(text_to_speak)