2011-02-28 135 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.