Unexpected error in speech recognition

Eduardo Gomez 2,561 Reputation points

I worked with a friend on Saturday, and my code worked perfectly.

We were able to start recognition from a file and return the string to the ViewModel

List<char> Characers = new();

        StringBuilder builder = new();  

        var config = SpeechConfig.FromSubscription  
            (ConstantsHelpers.AZURE_KEY, ConstantsHelpers.AZURE_REGION);  

        //Configure speech recognition  

        var speechRecognizerWaiter = new TaskCompletionSource<string>();  

        using var audioConfig = AudioConfig.FromWavFileInput(FilePath);  
        if (!string.IsNullOrEmpty(FileName))  
            config.SpeechRecognitionLanguage = Lang;  

            using var speechRecognizer = new SpeechRecognizer(config, audioConfig);  

            speechRecognizer.Recognized += (sender, e) =>  
                if (e.Result.Reason == ResultReason.RecognizedSpeech)  
                    foreach (var item in e.Result.Text)  

            speechRecognizer.SessionStarted += (sender, e) =>  

                Debug.WriteLine("-----------> started");  

            speechRecognizer.SessionStopped += (sender, e) =>  

                Debug.WriteLine("-----------> stooped");  

                foreach (var item in Characers)  



            await speechRecognizer.StartContinuousRecognitionAsync();  

            var str = await speechRecognizerWaiter.Task;  

            await speechRecognizer.StopContinuousRecognitionAsync();  

            return str;  

        return null;  

Today I tried it and it is giving me some exceptions in the audioConfig

"Exception with an error code: 0x1 (SPXERR_UNINITIALIZED)"

audioConfig.AudioProcessingOptions = 'audioConfig.AudioProcessingOptions' threw an exception of type 'System.ApplicationException'

I tried to search on Google for any clue, and I read that I should update my Nugget Package. I tried to search for any update.

and I still have the same error


I am in the lastest

Not Monitored
Not Monitored
Tag not monitored by Microsoft.
27,205 questions
{count} vote