Question Speech Recognize

harsha_lasith

New member
Joined
Nov 16, 2008
Messages
1
Programming Experience
Beginner
Hi all,
I try to do sample speech recognize program.but it not work.im new to this program.iv try to do that in first time.please tell me is this code wrong or any thing need to add to this program and how to do this.this is my code

thanks.

VB.NET:
Option Explicit Off

Imports System
Imports System.IO
Imports System.Media
Imports System.Reflection
Imports System.Resources
Imports System.Runtime.InteropServices
Imports System.Windows.Forms.Application
Imports SpeechLib



Public Class Form1
    Public WithEvents RC As SpSharedRecoContext
    Public myGrammar, b As ISpeechRecoGrammar

    Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load

        Try
            RC = New SpSharedRecoContext
            Label1.Text = "Form Loaded"
            myGrammar = RC.CreateGrammar
            myGrammar.CmdLoadFromFile("E:/SP new/sol.xml", SpeechLoadOption.SLODynamic)
            myGrammar.CmdSetRuleIdState(0, SpeechRuleState.SGDSActive)
            Label1.Text = "Grammar Loaded"
        Catch ex As Exception
            Label2.Text = ex.Message
        End Try
    End Sub

    Private Sub RC_FalseRecognition(ByVal StreamNumber As Long, ByVal StreamPosition As Object, ByVal Result As SpeechLib.ISpeechRecoResult)
        Label1.Text = "(no recognition)"

    End Sub

    Private Sub RC_Recognition(ByVal StreamNumber As Long, ByVal StreamPosition As Object, ByVal RecognitionType As SpeechLib.SpeechRecognitionType, ByVal Result As SpeechLib.ISpeechRecoResult)
        Label1.Text = Result.PhraseInfo.GetText
    End Sub


    Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click


    End Sub
End Class
 
Back
Top