跳到主要内容
Google Cloud Text-to-Speech 使开发者能够合成自然语音,提供 100 多种语音,支持多种语言和变体。它应用了 DeepMind 在 WaveNet 方面的突破性研究和谷歌强大的神经网络,以提供最高保真度。 它支持多种语言,包括英语、德语、波兰语、西班牙语、意大利语、法语、葡萄牙语和印地语。
本笔记本演示了如何与 Google Cloud Text-to-Speech API 交互以实现语音合成功能。 首先,您需要设置一个 Google Cloud 项目。您可以按照此处的说明进行操作。
!pip install -U langchain-google-community[texttospeech]

实例化

from langchain_google_community import TextToSpeechTool

已弃用的 GoogleCloudTextToSpeechTool

from langchain_community.tools import GoogleCloudTextToSpeechTool
text_to_speak = "Hello world!"

tts = GoogleCloudTextToSpeechTool()
tts.name
我们可以生成音频,将其保存到临时文件,然后播放。
speech_file = tts.run(text_to_speak)

以编程方式连接这些文档到 Claude、VSCode 等,通过 MCP 获取实时答案。
© . This site is unofficial and not affiliated with LangChain, Inc.