Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Transcribe Audio file to text using SAPI

42 views
Skip to first unread message

Umaid

unread,
Dec 5, 2009, 6:41:01 AM12/5/09
to
I have accomplish Speech to text from Microphone. Now my task is to
transcribe audio wave file into text using SAPI 5.1. Please help me in this
domain.

I have tried some code but didn't work for me.

Imports System
Imports SpeechLib
Imports System.Speech.Recognition
'Imports AudioUtils;

Public Class Form1

Dim WithEvents sre As SpeechRecognitionEngine

Private Sub btnLiterate_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles btnLiterate.Click
If TextBox1.Text.Trim.Length = 0 Then Exit Sub
sre.SetInputToWaveFile(TextBox1.Text)
Dim r As RecognitionResult
r = sre.Recognize()
If r Is Nothing Then
TextBox2.Text = "Could not fetch result"
Return
End If
TextBox2.Text = r.Text
End Sub

Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles Button1.Click
TextBox1.Text = String.Empty

Dim fileDlg As New OpenFileDialog()
'Dim wave As WaveFile()

If fileDlg.ShowDialog() = DialogResult.OK Then
'wave = New WaveFile(fileDlg.FileName)

TextBox1.Text = "Reading .WAV file..."

'wave.Read()

TextBox1.Text = OpenFileDialog1.FileName
'TextBox1.Text = "Finished Reading .WAV file..."

'm_DrawWave = True

Refresh()

End If


'Dim dr As DialogResult
'dr = OpenFileDialog1.ShowDialog()
'If dr = Windows.Forms.DialogResult.OK Then
' If Not OpenFileDialog1.FileName.Contains("D:\\Documents and
Settings\\Umaid\\My Documents\\Visual Studio
2008\\Projects\\AudioTest\\AudioTest\\Check1.wav") Then
' MessageBox.Show("Incorrect file")
' Else
' TextBox1.Text = OpenFileDialog1.FileName
' End If
'End If
End Sub

Public Sub New()

' This call is required by the Windows Form Designer.
InitializeComponent()

sre = New SpeechRecognitionEngine()

End Sub

Private Sub sre_LoadGrammarCompleted(ByVal sender As Object, ByVal e As
System.Speech.Recognition.LoadGrammarCompletedEventArgs) Handles
sre.LoadGrammarCompleted

End Sub

Private Sub sre_SpeechHypothesized(ByVal sender As Object, ByVal e As
System.Speech.Recognition.SpeechHypothesizedEventArgs) Handles
sre.SpeechHypothesized
System.Diagnostics.Debug.Print(e.Result.Text)
End Sub

Private Sub sre_SpeechRecognitionRejected(ByVal sender As Object, ByVal
e As System.Speech.Recognition.SpeechRecognitionRejectedEventArgs) Handles
sre.SpeechRecognitionRejected
System.Diagnostics.Debug.Print("Rejected: " & e.Result.Text)
End Sub

Private Sub sre_SpeechRecognized(ByVal sender As Object, ByVal e As
System.Speech.Recognition.SpeechRecognizedEventArgs) Handles
sre.SpeechRecognized
System.Diagnostics.Debug.Print(e.Result.Text)
End Sub

Private Sub Form1_Load(ByVal sender As Object, ByVal e As
System.EventArgs) Handles Me.Load
Dim words As String() = New String() {"Umaid Saleem"}
Dim c As New Choices(words)
Dim grmb As New GrammarBuilder(c)
Dim grm As Grammar = New Grammar(grmb)
sre.LoadGrammar(grm)
End Sub

End Class

Tom K

unread,
Jan 28, 2010, 7:40:14 AM1/28/10
to
Testing to post.
I have a pc. Try to know more about.


"Umaid" <Um...@discussions.microsoft.com> 在郵件
news:0C571C4C-5538-4396...@microsoft.com 中撰寫...

0 new messages