【发布时间】:2017-12-31 03:28:59
【问题描述】:
晚上好。我正在尝试使用简单的延迟来制作混响效果,但尽管使用了 SpeakAsync 方法,但代码不会继续执行。
我在任何地方都找不到有关此问题的文档,因此我非常感谢您提供的任何提示。感谢您的时间! 我在 Visual Studio 2017 中使用 System.Speech 版本 4.0.0。 我的目标是运行时 4.5.2
Imports System.Speech.Synthesis
Imports System.Threading
Imports System.Threading.Tasks
Module Module1
Sub main()
Dim SpeechString As String = "This is a test phrase, there are many
like it, but this one is mine."
Call OutSpeech(1, 100, SpeechString)
End Sub
Sub OutSpeech(SpeechRate As Integer, SpeechVolume As Integer, SpeechText As String)
Dim SpeechHolder As New SpeechSynthesizer
SpeechHolder.Rate = SpeechRate
SpeechHolder.Volume = SpeechVolume
SpeechHolder.SpeakAsync(SpeechText)
Thread.Sleep(100)
SpeechHolder.SpeakAsync(SpeechText)
Console.ReadLine()
End Sub
结束模块
【问题讨论】:
-
顺便说一句,在您的问题中您引用了
Microsoft Speech,但您的代码使用了System.Speech。这是两个不同的程序集,您应该对此更加具体。
标签: vb.net text-to-speech speech-synthesis