如何在Windows 10上的python 3.5中将文本转换为语音?

Pra*_*dhi 3 text-to-speech python-3.x

我尝试使用espeak,但没有成功,并且某些功能仅在python 2中受支持。

小智 6

对于脱机使用:直接使用SAPI [Windows]

以下代码将有助于演示...

import win32com.client speaker = win32com.client.Dispatch("SAPI.SpVoice") speaker.Speak("Jumpman Jumpman Jumpman Them boys up to something!")


say*_*yan 4

您是否尝试过通过gTTS使用 Google 文本转语音?

在Python 3.x中使用它的语法如下:

from gtts import gTTS
my_tts = "Text you want to process"
tts = gTTS(text=my_tts, lang='en')
tts.save("Absolute/path/to/file.mp3")
Run Code Online (Sandbox Code Playgroud)

这是gTTS 的github 存储库