Click here to Skip to main content
16,007,814 members
Home / Discussions / Visual Basic
   

Visual Basic

 
GeneralConvert date to string Pin
Anonymous8-Mar-05 5:52
Anonymous8-Mar-05 5:52 
GeneralRe: Convert date to string Pin
Jim Matthews8-Mar-05 7:37
Jim Matthews8-Mar-05 7:37 
QuestionHow do you declare a VB6 control in VB.NET? Pin
Sarphus8-Mar-05 5:05
Sarphus8-Mar-05 5:05 
AnswerRe: How do you declare a VB6 control in VB.NET? Pin
rwestgraham8-Mar-05 14:03
rwestgraham8-Mar-05 14:03 
GeneralRe: How do you declare a VB6 control in VB.NET? Pin
Sarphus10-Mar-05 2:46
Sarphus10-Mar-05 2:46 
GeneralListViews Pin
lmaks8-Mar-05 3:53
lmaks8-Mar-05 3:53 
GeneralRe: ListViews Pin
H@is@here11-Mar-05 12:14
H@is@here11-Mar-05 12:14 
GeneralMS Speech SDK 5.1 Problem-EMERGENCY! Pin
ZisisSim8-Mar-05 3:36
ZisisSim8-Mar-05 3:36 
I am trying to recognize text from a recorded wav file.
I use MS Speech SDK 5.1 and VB.Net.
Here's my project . It compiles OK but i get nothing as a recognized text.PLEASE HELP!

I have an initialise function ,an openstream function to open the file i want and the other important function is the RecoContext_Recognition which is called when a recognition event is created.
What am i doing wrong?!?!?

Imports SpeechLib
Public Class STT_Controller

Private Recocontext As SpInProcRecoContext = New SpeechLib.SpInProcRecoContextClass 'Recognized context
Private grammar As ISpeechRecoGrammar 'Recognize Grammar
Private inputfile As New SpFileStream 'Imported file stream
Private reco As SpInprocRecognizer = New SpInprocRecognizerClass

Public ErrorNumber As Integer
Private StreamOpened As Boolean = False
Private STTResult As String = ""

Event Recognition_EndOfStream()
Event Recognition_Start()

Public ReadOnly Property ResultText()
Get
Return STTResult
End Get
End Property


Public Sub Initialise() 'Ekkinisi tis engine

On Error Resume Next

Dim reco As SpInprocRecognizer = New SpInprocRecognizerClass
If Not (Err.Number = 0) Then ErrorNumber = 704
'Event Handlers
AddHandler Recocontext.EndStream, AddressOf RecoContext_EndStream
AddHandler Recocontext.Recognition, AddressOf RecoContext_Recognition

Recocontext = reco.CreateRecoContext
If Not (Err.Number = 0) Then ErrorNumber = 701
grammar = Recocontext.CreateGrammar
If Not (Err.Number = 0) Then ErrorNumber = 702
grammar.DictationLoad()
If Not (Err.Number = 0) Then ErrorNumber = 703
End Sub
Public Sub Activate()
On Error Resume Next
grammar.DictationSetState(SpeechRuleState.SGDSActive)
If Not (Err.Number = 0) Then ErrorNumber = 801
End Sub
Public Sub Deactivate(Optional ByVal UnloadGrammar As Boolean = False)
On Error Resume Next
grammar.DictationSetState(SpeechRuleState.SGDSInactive)
If UnloadGrammar = True Then grammar.DictationUnload()
End Sub
Private Sub RecoContext_EndStream(ByVal StreamNumber As Integer, ByVal StreamPosition As Object, ByVal StreamReleased As Boolean)
RaiseEvent Recognition_EndOfStream()
Deactivate()
End Sub
Private Sub RecoContext_Recognition(ByVal StreamNumber As Integer, ByVal StreamPosition As Object, ByVal RecognitionType As SpeechLib.SpeechRecognitionType, ByVal result As SpeechLib.ISpeechRecoResult)
RaiseEvent Recognition_EndOfStream()
STTResult = result.PhraseInfo.GetText
End Sub
Public Sub OpenStream(ByVal Fname As String, ByVal mode As SpeechLib.SpeechStreamFileMode, Optional ByVal DoEv As Boolean = False)
On Error GoTo openstreamerr
If StreamOpened = True Then inputfile.Close()
inputfile.Open(Fname, mode, DoEv)
StreamOpened = True
reco.AudioInputStream = inputfile

Exit Sub
openstreamerr:
ErrorNumber = 601
End Sub

Public Sub CloseStream()
On Error GoTo CloseStreamerr
inputfile.Close()
StreamOpened = False
Exit Sub
CloseStreamerr:
ErrorNumber = 602
End Sub
End Class

May it be your fate to live in interesting times
GeneralGetting Context Menu to close if already open Pin
7-Mar-05 23:43
suss7-Mar-05 23:43 
GeneralRe: Getting Context Menu to close if already open Pin
Computer_Guy25-May-06 15:17
Computer_Guy25-May-06 15:17 
QuestionCalling DLL functions using relative paths? Pin
Axonn Echysttas7-Mar-05 22:18
Axonn Echysttas7-Mar-05 22:18 
AnswerRe: Calling DLL functions using relative paths? Pin
Dave Kreskowiak8-Mar-05 3:02
mveDave Kreskowiak8-Mar-05 3:02 
GeneralRe: Calling DLL functions using relative paths? Pin
Axonn Echysttas8-Mar-05 8:10
Axonn Echysttas8-Mar-05 8:10 
GeneralWord Wrapping with Draw String Pin
Chaos Machine7-Mar-05 12:52
Chaos Machine7-Mar-05 12:52 
GeneralRe: Word Wrapping with Draw String Pin
Christian Graus7-Mar-05 12:55
protectorChristian Graus7-Mar-05 12:55 
GeneralRe: Word Wrapping with Draw String Pin
Chaos Machine7-Mar-05 13:55
Chaos Machine7-Mar-05 13:55 
QuestionHow to save the state of TreeView Pin
ac_vbdeveloper7-Mar-05 11:04
ac_vbdeveloper7-Mar-05 11:04 
Generalvb .net and fox Pro Pin
Anonymous7-Mar-05 10:57
Anonymous7-Mar-05 10:57 
QuestionHow can I hide a column value from view in my Datagrid Pin
Lisana7-Mar-05 8:31
Lisana7-Mar-05 8:31 
AnswerRe: How can I hide a column value from view in my Datagrid Pin
Jim Matthews7-Mar-05 10:12
Jim Matthews7-Mar-05 10:12 
GeneralRe: How can I hide a column value from view in my Datagrid Pin
Lisana7-Mar-05 10:36
Lisana7-Mar-05 10:36 
GeneralRe: How can I hide a column value from view in my Datagrid Pin
Jim Matthews8-Mar-05 7:05
Jim Matthews8-Mar-05 7:05 
GeneralRe: How can I hide a column value from view in my Datagrid Pin
Lisana8-Mar-05 10:47
Lisana8-Mar-05 10:47 
GeneralRe: How can I hide a column value from view in my Datagrid Pin
Anonymous9-Mar-05 20:44
Anonymous9-Mar-05 20:44 
AnswerRe: How can I hide a column value from view in my Datagrid Pin
westerdlyOne_void8-Mar-05 10:46
westerdlyOne_void8-Mar-05 10:46 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.