本文介绍了如何在vb.net 2010中将音频文件转换为word文件?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

推荐答案

Dim sre As New SpeechRecognitionEngine()
Dim gr As Grammar = New DictationGrammar()
sre.LoadGrammar(gr)
sre.SetInputToWaveFile("YourWavFileLocation") 'you must give full path 
sre.BabbleTimeout = New TimeSpan(Int32.MaxValue)
sre.InitialSilenceTimeout = New TimeSpan(Int32.MaxValue)
sre.EndSilenceTimeout = New TimeSpan(100000000)
sre.EndSilenceTimeoutAmbiguous = New TimeSpan(100000000)

Dim sb As New StringBuilder()
While True
    Try
        Dim recText = sre.Recognize()
        If recText Is Nothing Then
            Exit Try
        End If

        sb.Append(recText.Text)
    Catch ex As Exception
        'handle exception
        'give msgbox about error or etc
    End Try
End While
Return sb.ToString()



这篇关于如何在vb.net 2010中将音频文件转换为word文件?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

10-28 19:50