SpeechRecognitionEngine culture error

JacopoBiondi

New member
Joined
Jun 11, 2022
Messages
1
Programming Experience
1-3
Hello everyone. I state that I am brand new in c# and I encountered a problem in my first project. I am creating a voice assistant. To receive voice input from the user, I wanted to use System.Speech.Recognition. The code is
C#:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Speech.Synthesis;
using System.Speech.Recognition;
using System.Threading;

namespace AssistenteVocale
{
    class Assistente
         {
               static void Main(string[] args)
               {
                      SpeechRecognitionEngine recognizer = new SpeechRecognitionEngine(new System.Globalization.CultureInfo("it-it"));
                      recognizer.LoadGrammar(new DictationGrammar());
                      recognizer.SpeechRecognized += new EventHandler<SpeechRecognizedEventArgs>(recognizer_SpeechRecognized);
                      recognizer.SetInputToDefaultAudioDevice();
                      recognizer.RecognizeAsync(RecognizeMode.Multiple);
               }
               static void recognizer_SpeechRecognized(object sender, SpeechRecognizedEventArgs e)
               {
                      Console.WriteLine("Recognized text: " + e.Result.Text);
               }
        }
}
but I receive an error in the first line of the static void main: the error is
System.ArgumentException: 'Could not find a recognition with the required ID. Parameter name: culture'

Help pls🙌🙌
 
Last edited by a moderator:
Look in Windows Settings, Time & Language, Speech. Have you installed the Italian speech pack?
 

Latest posts

Back
Top Bottom