Search code examples
c#windowsnaudiosystem.speech.recognition

Please tell me how to change the microphone device of "Speech Recognition Engine"


I'm currently using the "Speech Recognition Engine" to check if there is a human voice. The accuracy of recognition is not good enough, but for the time being, it works well in that it picks up human voices. However, I am in trouble because I can only see the following default settings for the microphone settings.

    SpeechRecognitionEngine engine = new SpeechRecognitionEngine();
    engine.SetInputToDefaultAudioDevice();

Does anyone know how to switch to another microphone device?

For example, for "NAudio", you can change the microphone device as follows.

    WaveIn waveIn waveIn = new WaveIn()
    {
        DeviceNumber = 0,
    };

For "SpeechRecognitionEngine", what should I do for C#? By the way, I'm using .Net Framework 4.7.2.

I hope someone can help.


Solution

  • Let me answer for your erased question in msdn.

    You can get byte data using NAudio, convert it to a Stream, and pass it to SetInputToAudioStream.