编程错误

发布于 2024-10-16 10:12:24 字数 809 浏览 1 评论 0原文

Imports SpeechLib

Public Class Form1
    Public vox = CreateObject("sapi.spvoice")
    Private Sub cmdSpeak_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles cmdSpeak.Click
        Dim t As String = "Hello , This is a Text"
        Say(t)
    End Sub

    Public Sub Say(ByVal text As String)
        vox.Speak(text,SpeechVoiceSpeakFlags.SVSFlagsAsync)
    End Sub

    Private Sub cmdPause_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles cmdPause.Click
        vox.pause()
    End Sub

    Private Sub Form1_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
        vox.AlertBoundary = SVEPhoneme
    End Sub
End Class

我收到错误

未声明名称“SVEPhoneme”。

我如何以及在哪里申报?

Imports SpeechLib

Public Class Form1
    Public vox = CreateObject("sapi.spvoice")
    Private Sub cmdSpeak_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles cmdSpeak.Click
        Dim t As String = "Hello , This is a Text"
        Say(t)
    End Sub

    Public Sub Say(ByVal text As String)
        vox.Speak(text,SpeechVoiceSpeakFlags.SVSFlagsAsync)
    End Sub

    Private Sub cmdPause_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles cmdPause.Click
        vox.pause()
    End Sub

    Private Sub Form1_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
        vox.AlertBoundary = SVEPhoneme
    End Sub
End Class

I am getting an error

Name 'SVEPhoneme' is not declared.

How and where do I declare it ?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

吃颗糖壮壮胆 2024-10-23 10:12:24

它是 SpeechVoiceEvents.SVEPhoneme

如果您提前绑定此代码,这一切都会容易得多:

Public vox as New SpVoice

或者更好的是,使用 sapi、System.Speech 程序集的 .NET 包装器。

Imports System.Speech.Synthesis

Public Class Form1
    Public vox As New SpeechSynthesizer

    Public Sub Say(ByVal text As String)
        vox.SpeakAsync(text)
    End Sub
End Class

It is SpeechVoiceEvents.SVEPhoneme

This is all a lot easier if you make this code early bound:

Public vox as New SpVoice

Or better yet, use the .NET wrapper for the sapi, System.Speech assembly.

Imports System.Speech.Synthesis

Public Class Form1
    Public vox As New SpeechSynthesizer

    Public Sub Say(ByVal text As String)
        vox.SpeakAsync(text)
    End Sub
End Class
郁金香雨 2024-10-23 10:12:24

SVEPhoneme 代表 Phoneme 事件,当引擎在说话时完成一个音素时就会发生该事件。

尝试将 SVEPhoneme 设置为整数 64。

http:/ /msdn.microsoft.com/en-us/library/ms720886(v=vs.85).asp

SVEPhoneme represents the Phoneme event, which occurs when the engine completes a phoneme while speaking.

Try setting SVEPhoneme to be the integer 64.

http://msdn.microsoft.com/en-us/library/ms720886(v=vs.85).asp

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文