0

请看下面的代码片段

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);

当它到达e.SetInputToWaveStream(stream);时抛出错误System.FormatException: Wave file not valid

这里有什么问题?

4

1 回答 1

0

发现问题。stream.Position = 0在将其设置为输入之前需要调用

于 2013-05-28T19:20:28.117 回答