【问题标题】:System.FormatException: Wave file not validSystem.FormatException:波形文件无效
【发布时间】:2013-05-29 03:20:28
【问题描述】:

请看下面的代码sn-p

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

这里有什么问题?

【问题讨论】:

    标签: c# .net visual-studio-2010 speech-recognition formatexception


    【解决方案1】:

    发现问题。在输入之前需要调用stream.Position = 0

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2019-02-08
      • 2017-09-03
      • 1970-01-01
      相关资源
      最近更新 更多