1

I have a small sample application to test speech recog. It works in some machines but not in other machines. In my dev environment where I first installed the necessary packages, it all worked 100% with no issues. But, my team mates are unable to get it working with the installation of our software that has this code in it. We have mixed environments where in some cases we are using Remote Desktop with the application running on the remote machine (so with the device integration via RDP). And also locally without RDP. It does not detect the mic in both cases. Windows detects the mic. The recorder app works and testing all works so we know the mic is being recognized by windows.

However, the speech SDK does not recognize it.

I have tried 2 ways. First ,with using the FromDefaultMicrophoneInput But with that not working, i changed it to FromMicrophoneInput instead and specifed the microphone ID.

Using NAudio to enumerate the microphones, the mic is detected and listed:

var enumerator = new MMDeviceEnumerator();
                string specifiedMicID = string.Empty;
                foreach (var endpoint in
                         enumerator.EnumerateAudioEndPoints(DataFlow.Capture, DeviceState.Active))
                {
                    if (endpoint.FriendlyName != this.MicName)
                        continue;
                    else
                    {
                        specifiedMicID = endpoint.ID;
                        break;
                    }
                }
                audioConfig = AudioConfig.FromMicrophoneInput(specifiedMicID);

But, when trying to instantiate the SpeechRecognizer with that audio config:

using (var recognizer = new SpeechRecognizer(config, audioConfig))
            {
...
}

We get the SPXERR_MIC_NOT_FOUND. Even thought it is clearly there and working in all other cases in windows and with Naudio detecting it fine.

Any ideas what is going on here?

Thank youj.

R123
  • 61
  • 3

1 Answers1

0

Are you creating a UWP application? If so, you'll need to retrieve the audio device IDs differently:

var devices = await DeviceInformation.FindAllAsync(DeviceClass.AudioCapture);

foreach (var device in devices)
{
    Console.WriteLine($"{device.Name}, {device.Id}\n");
}

Please refer to the documentation here for more information: https://learn.microsoft.com/en-us/azure/cognitive-services/speech-service/how-to-select-audio-input-devices#audio-device-ids-on-uwp

If you're still having issues, we'd need to get the SDK logs to debug further. Instructions on how to turn on logging can be found here: https://learn.microsoft.com/en-us/azure/cognitive-services/speech-service/how-to-use-logging

Ralph
  • 101
  • 2
  • Not a UWP, Just windows forms. We suspect this is an OS issue since not supported officially on anything pre-windows 10. We are proceeding as such with our clients. – R123 Sep 23 '20 at 13:19