Click here to Skip to main content
15,867,956 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I tried using this code
SpeechRecognitionResult speechRecognitionResult = await speechRecognizer.RecognizeAsync();
textBox1.Text = speechRecognitionResult.Text;

But it provide output only 1 time but i want to get output continuous till i close it myself. Please help me how i can do that.

I tried this method but its providing nothing.
await speechRecognizer.CompileConstraintsAsync();


            speechRecognizer.ContinuousRecognitionSession.ResultGenerated +=
                async (s, e1) =>
                {
                    if ((e1.Result != null))
                    {
                        await this.Dispatcher.RunAsync(CoreDispatcherPriority.Low,
                            () =>
                        {
                                var result = e1.Result.Text;
                            textBox1.Text = result;
                        });
                        speechRecognizer.ContinuousRecognitionSession.Resume();
                    }

                };
            await speechRecognizer.ContinuousRecognitionSession.StartAsync(SpeechContinuousRecognitionMode.PauseOnRecognition);

please help,Thanks and must reply. :)

What I have tried:

I tried using this code


SpeechRecognitionResult speechRecognitionResult = await speechRecognizer.RecognizeAsync();
textBox1.Text = speechRecognitionResult.Text;


But it provide output only 1 time but i want to get output continuous till i close it myself. Please help me how i can do that.
Posted
Updated 28-Oct-20 1:46am
v2

1 solution

SpeechRecognitionEngine s = new SpeechRecognitionEngine();
Grammar words = new DictationGrammar();
s.LoadGrammar(words);
try
{
s.SetInputToDefaultAudioDevice();
RecognitionResult result = s.Recognize();
richTextBox1.Text = result.Text;
}
catch (Exception ex)
{
MessageBox.Show(ex.Message);
}
finally
{
s.UnloadAllGrammars();
}
 
Share this answer
 
Comments
CHill60 28-Oct-20 8:38am    
This will also only do it once and therefore is not a solution to this 3 year old question. It's good that you want to help, but please read the questions carefully. Also learn how to format your code and always add some commentary

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900