2011-02-28 105 views
2

文本到語音轉換爲英語語言使用Visual Basic 2008文本到語音

Dim speech As Object = CreateObject("SAPI.SpVoice") 
speech.speak(TextBox1.Text) 

我的問題,這可怎麼使用其他語言(講什麼語言!) ? 謝謝

+0

該代碼不能編譯。還有你在說什麼其他的語言?口語?編程語言? – 2011-02-28 12:19:37

+0

使用語言 – sam 2011-03-01 19:33:51

回答

4

SAPI接口在.NET 3.0,System.Speech.Synthesis命名空間中得到了很好的包裝。可用於任何.NET兼容語言。

Imports System.Speech.Synthesis 
... 
    Dim synth = New SpeechSynthesizer 
    synth.Speak("Works in any .NET language") 

You must first Add a reference to System.Speech: 
click menu Project, then Add Reference to .NET, then System.Speech. 
Otherwise the code above will fail at the Imports System.Speech.Synthesis  line.