Really need help :) I got finished all the code..but i wanted you to help me for understanding the two lines (the first steps)
this is a code of .. SPEECH to TEXT .. :)


This is the lines that i need you to explain to me :)
you need to add a SpSharedRecoContext object and create an ISpeechRecoGrammar object for it. Then Add a RecognitionHandler to it...

Add another Button and a TextBox to your form and create the objects there. Then add a handler to tie into the listeners Recognition event...
view sourceprint?


and this is all the quote code :)

private void btnListen_Click(object sender, EventArgs e)
{
    // Speech Recognition Object
    SpSharedRecoContext listener;
    // Grammar object
    ISpeechRecoGrammar grammar;
 listener = new SpeechLib.SpSharedRecoContext();
listener.Recognition += new_ISpeechRecoContextEvents_RecognitionEventHandler (listener_Reco);
    grammar = listener.CreateGrammar(0);
    grammar.Dictationload("", SpeechLoadOption.SLOStatic);
    grammar.DictationSetState(SpeechRuleState.SGDSActive);
}

public void listener_Reco(int StreamNumber, object StreamPosition, SpeechRecognitionType RecognitionType, ISpeechRecoResult Result)
{
    string heard = Result.PhraseInfo.GetText(0, -1, true);
    textBox1.Text += heard;
}

Recommended Answers

All 8 Replies

What exactly is your question? Is there a problem with your code; Does it not behave correctly?


N.B Please try to limit your use of the red font for highlighting one or tweo words; Large blocks of red text are quite hard on the eyes

thanks for replaying :)
my question is that i don't understand this lines .

you need to add a SpSharedRecoContext object and create an ISpeechRecoGrammar object for it. Then Add a RecognitionHandler to it...

Add another Button and a TextBox to your form and create the objects there. Then add a handler to tie into the listeners Recognition event...
view sourceprint?

What means adding an "object" & "handler" >

Am i correct in thinking you didnt write the code posted?

My master did :)

give me the solution sir i want the code for that

the code is typed above.

how to add a SpSharedRecoContext object and create an ISpeechRecoGrammar object...i need it urgently...can u plz send me the total code how to convert speech to text.....plzzz

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.