2012-12-07 78 views

回答

1

您可以通過pyttsx模塊實現它。它使用默認的MS語音識別系統。

import pyttsx 

engine = pyttsx.init() 
engine.say("Your Message") 
engine.runAndWait() 
2

我知道它的真正晚在這裏回答,但我想我會在這裏發佈,因爲我基於使用SAPIpythonTTS轉換,這是OP的原來的問題有解決方案。

這對於使用SAPIpython尋找解決方案的其他人可能會有用。

from win32com.client import constants, Dispatch 

Msg = "Hi this is a test" 

speaker = Dispatch("SAPI.SpVoice") #Create SAPI SpVoice Object 
speaker.Speak(Msg)     #Process TTS 
del speaker       #Delete speaker object and free up memory 
+0

你能告訴我怎樣才能改變它的聲音,女聲(​​也語) –

+0

還耽誤..... –

+0

我沒有親自做這件事,但根據研究,這可能是可能的通過設置「Sapi.SpVoice.Voice」屬性來改變語音。請參閱此處的SAPI文檔http://www.microsoft.com/en-us/download/details.aspx?id=10121 –