Found the issue. Need to call stream.Position = 0
before setting it into input
System.FormatException: Wave file not valid
-
30-05-2022 - |
Domanda
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?
Soluzione
Autorizzato sotto: CC-BY-SA insieme a attribuzione
Non affiliato a StackOverflow