Mic not detecting. Getting Unhandled exception (Exception with an error code: 0xe (SPXERR_MIC_NOT_AVAILABLE))

Pranam K 6 Reputation points
2021-03-17T06:04:07.627+00:00

I have been executing code as per Microsoft Learn :

https://learn.microsoft.com/en-us/learn/modules/transcribe-speech-input-text/7-optional-exercise-listen-incoming-data?pivots=csharp

  • My Earphone/Audio is totally fine.
  • I'm using Visual Studio Code.

Whenever I run this code, I'm getting error :

$ dotnet run
Begin speaking....
Unhandled exception. System.AggregateException: One or more errors occurred. (Exception with an error code: 0xe (SPXERR_MIC_NOT_AVAILABLE))
---> System.ApplicationException: Exception with an error code: 0xe (SPXERR_MIC_NOT_AVAILABLE)
at Microsoft.CognitiveServices.Speech.Internal.SpxExceptionThrower.ThrowIfFail(IntPtr hr)
at Microsoft.CognitiveServices.Speech.Recognizer.FromConfig(GetRecognizerFromConfigDelegate fromConfig, SpeechConfig speechConfig)
at Microsoft.CognitiveServices.Speech.SpeechRecognizer..ctor(SpeechConfig speechConfig)
at helloworld.Program.RecognizeSpeechAsync() in C:\Users\Indhu\Desktop\Convert-Audio-From-Microphone\Program.cs:line 18
--- End of inner exception stack trace ---
at System.Threading.Tasks.Task.Wait(Int32 millisecondsTimeout, CancellationToken cancellationToken)
at System.Threading.Tasks.Task.Wait()
at helloworld.Program.Main() in C:\Users\Indhu\Desktop\Convert-Audio-From-Microphone\Program.cs:line 48

------------------------------------------------------

Code : (I have attached. Rename it to Program.cs)78520-program.txt

Azure AI Speech
Azure AI Speech
An Azure service that integrates speech processing into apps and services.
1,413 questions
.NET CLI
.NET CLI
A cross-platform toolchain for developing, building, running, and publishing .NET applications.
323 questions
C#
C#
An object-oriented and type-safe programming language that has its roots in the C family of languages and includes support for component-oriented programming.
10,306 questions
{count} vote

1 answer

Sort by: Most helpful
  1. Viorel 112.5K Reputation points
    2021-03-17T11:49:15.53+00:00

    According to some similar problems, check if your microphone is available using other programs, such as Windows Voice Recorder, for example.

    You can also check and debug your code using Visual Studio.

    0 comments No comments