Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Speech Recognition Engine will not recognize multiple times

With the code below it works and return the first recognition, but not the everything else. What am I doing wrong? Am I suppose to be in some kind of loop?

    public void Transcribe()
    {
        SpeechRecognitionEngine SRE = new SpeechRecognitionEngine();
        SRE.LoadGrammar(new DictationGrammar());

        SRE.SetInputToWaveFile(_fileName);
        SRE.SpeechRecognized += new EventHandler<SpeechRecognizedEventArgs>(SRE_SpeechRecognized);
        SRE.RecognizeCompleted += new EventHandler<RecognizeCompletedEventArgs>(SRE_RecognizeCompleted);
        SRE.RecognizeAsync(RecognizeMode.Multiple);    
    }

    void SRE_RecognizeCompleted(object sender, RecognizeCompletedEventArgs e)
    {
        Console.WriteLine(e.Result.Text);
    }

    void SRE_SpeechRecognized(object sender, SpeechRecognizedEventArgs e)
    {            
    }
like image 777
TCoder Avatar asked Feb 17 '26 04:02

TCoder


1 Answers

Use SpeechRecognized as your event handler to do the Console.WriteLine(). I ran into the same thing just now.

like image 169
Jonathan Mitchem Avatar answered Feb 18 '26 18:02

Jonathan Mitchem



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!