簡體   English   中英

使用VB.NET 2008進行文本到語音轉換

[英]text-to-speech using VB.NET 2008

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

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

我的問題是,如何將其用於其他語言(口語!!!)? 謝謝

SAPI接口在.NET 3.0 System.Speech.Synthesis命名空間中得到了很好的包裝。 可用於任何.NET兼容語言。 使用項目>添加引用,然后選擇System.Speech。 編寫類似以下內容的代碼:

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

Sapi接口是COM接口。 您可以將其用於支持COM的大多數語言(在Windows上),例如PHP,C,VBA等。

...但是如果您指的是真實世界的語言,則必須安裝其他“語音”

您也可以在下面將其作為將文本閱讀器嵌入程序中的代碼。

Imports System.Speech
Imports System.Speech.Synthesis

........

Dim reader As  SpeechSynthesizer =  New SpeechSynthesizer

......
Reader.SpeakAsync(textbox1.text)
Reader.SpeakAsync("The above code assigns reader to read the text in textbox1")

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM