I am new to the Speech Recognition, so please excuse me if the question is very basic level.
My application captures what I speak through my microphone. I have written some responses using my c# code for every command I say and the SpeechSynthesizer does this without any issues using the code mentioned below. But I want the SpeechSynthesizer to respond back through my laptop speaker, rather than my default input device (my microphone). Is it doable?
The code I am currently using is given below. I am looking for something which can get all the playback devices available and then select and speak back using my speaker.
public void SpeakTheText(string text)
{
SpeechInput = text;
SpeechSynthesizer _synthesizer = new SpeechSynthesizer();
_synthesizer.SelectVoiceByHints(VoiceGender.Male);
_synthesizer.SetOutputToDefaultAudioDevice();//Microphone
_synthesizer.SpeakAsync(SpeechInput);
}
You could use the System.Media.SoundPlayer class to output the audio from a stream. See this example from MSDN
I'm not sure if SoundPlayer can specify an output device, but it should output using your default output device.