Please have a look at the following code snippet
using System.IO;
MemoryStream stream = new MemoryStream();
SpeechSynthesizer s = new SpeechSynthesizer();
s.setOutputToWaveStream(stream);
s.Speak("hello world");
SpeechRecognitionEngine e = new SpeechRecognitionEngine(new System.Globalization.CuntureInfo("en-US");
//Set grammar code goes here
e.SetInputToWaveStream(stream);
when it reaches to e.SetInputToWaveStream(stream);
it throws the error System.FormatException: Wave file not valid
What is the issue here?
Found the issue. Need to call stream.Position = 0
before setting it into input