Detect and Select Microphone Input Device for the Azure Speech Recognition (Speech To Text) cloud service in Unity

D4N005H 0 Reputation points
2024-04-06T12:33:19.2233333+00:00

Hello,

After reading all the documentation and studying an example that used NAudio to detect and select audio input devices, I noticed that NAudio does not work properly in Unity. Also, I tried feeding a series of audio samples from Unity to Azure's Speech Recognition by sending an audio sample using the streaming input feature but it was not successful.

All I want is to let the user choose their Audio Input device for the Speech Recognition service. Note that the service is being used in a Unity project (Standalone Windows Build).

Therefore, I am in need of help to overcome this issue and any detailed guidance is very appreciated.

Kind regards.

Azure AI Speech
Azure AI Speech
An Azure service that integrates speech processing into apps and services.
2,061 questions
{count} votes

1 answer

Sort by: Most helpful
  1. santoshkc 15,325 Reputation points Microsoft External Staff Moderator
    2024-04-08T07:05:28.4666667+00:00

    Hi @D4N005H,

    To select an audio input device for the Speech Recognition service in Unity, you can use the Speech SDK. The Speech SDK provides APIs for selecting audio input devices in C++, C#, Python, Objective-C, Java, and JavaScript. You can obtain the IDs of the audio devices connected to a system and use them in the Speech SDK to select the audio input.

    Here's an example of how to configure the audio device through the AudioConfig object in Python:

    audio_config = AudioConfig(device_name="<device id>");
    

    To obtain the IDs of the audio devices connected to a system, you can use the IMMDevice object in Windows for desktop applications. Audio device endpoint ID strings can be retrieved from the IMMDevice object.

    Here's a link to the official Azure documentation that explains how to select audio input devices in the Speech SDK: how-to-select-audio-input-devices.

    Also see: Quickstart: Recognize speech from a microphone in Unity using the Speech SDK for Unity.

    I hope this information helps! Thank you.

    1 person found this answer helpful.
    0 comments No comments

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.