gpt4 book ai didi

visual-studio-2010 - Visual Basic 中的语音转文本

转载 作者:行者123 更新时间:2023-12-03 16:07:53 32 4
gpt4 key购买 nike

我有用 Visual Basic 编写的语音到文本的代码,但它只能识别说出的第一个单词或句子,然后停止识别。我想让它继续听。我怎样才能做到这一点?问题是什么?
这是我现在的代码:

Imports System.Speech

Public Class Form1

Public synth As New Speech.Synthesis.SpeechSynthesizer
Public WithEvents recognizer As New Speech.Recognition.SpeechRecognitionEngine
Dim gram As New System.Speech.Recognition.DictationGrammar()

Public Sub GotSpeech(ByVal sender As Object, ByVal phrase As System.Speech.Recognition.SpeechRecognizedEventArgs) Handles recognizer.SpeechRecognized
words.Text += phrase.Result.Text & vbNewLine
End Sub

Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
recognizer.LoadGrammar(gram)
recognizer.SetInputToDefaultAudioDevice()
recognizer.RecognizeAsync()
End Sub
End Class

最佳答案

RecognizeAsync()做一个单一的识别。 RecognizeAsync(RecognizeMode.Multiple)会做多次识别。

关于visual-studio-2010 - Visual Basic 中的语音转文本,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/17409438/

32 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com