我下了simple Chinese 包
选择一段新闻念的时候总是没念完就停了,但是生成的.wav是完整的
//念中文代码
string read=(string)obj.GetData(DataFormats.Text);
SpeechVoiceSpeakFlags SpFlags = SpeechVoiceSpeakFlags.SVSFlagsAsync;
SpVoice Voice = new SpVoice();
Voice.Speak(read, SpFlags);
//生成.wav
DotNetSpeech.SpeechVoiceSpeakFlags SSF = DotNetSpeech.SpeechVoiceSpeakFlags.SVSFlagsAsync;
DotNetSpeech.SpVoice vo = new SpVoiceClass();
System.Windows.Forms.SaveFileDialog SFD = new System.Windows.Forms.SaveFileDialog();
SFD.Filter = "All files (*.*)|*.*|wav files (*.wav)|*.wav";
SFD.Title = "Save to a wav file";
SFD.FilterIndex = 2;
SFD.RestoreDirectory = true;
if (SFD.ShowDialog() == System.Windows.Forms.DialogResult.OK)
{
DotNetSpeech.SpeechStreamFileMode SSFM = DotNetSpeech.SpeechStreamFileMode.SSFMCreateForWrite;
DotNetSpeech.SpFileStream SFS = new DotNetSpeech.SpFileStreamClass();
SFS.Open(SFD.FileName, SSFM, false);
vo.AudioOutputStream = SFS;
vo.Speak((string)obj.GetData(DataFormats.Text), SSF);
vo.WaitUntilDone(System.Threading.Timeout.Infinite);
SFS.Close();
}
选择一段新闻念的时候总是没念完就停了,但是生成的.wav是完整的
//念中文代码
string read=(string)obj.GetData(DataFormats.Text);
SpeechVoiceSpeakFlags SpFlags = SpeechVoiceSpeakFlags.SVSFlagsAsync;
SpVoice Voice = new SpVoice();
Voice.Speak(read, SpFlags);
//生成.wav
DotNetSpeech.SpeechVoiceSpeakFlags SSF = DotNetSpeech.SpeechVoiceSpeakFlags.SVSFlagsAsync;
DotNetSpeech.SpVoice vo = new SpVoiceClass();
System.Windows.Forms.SaveFileDialog SFD = new System.Windows.Forms.SaveFileDialog();
SFD.Filter = "All files (*.*)|*.*|wav files (*.wav)|*.wav";
SFD.Title = "Save to a wav file";
SFD.FilterIndex = 2;
SFD.RestoreDirectory = true;
if (SFD.ShowDialog() == System.Windows.Forms.DialogResult.OK)
{
DotNetSpeech.SpeechStreamFileMode SSFM = DotNetSpeech.SpeechStreamFileMode.SSFMCreateForWrite;
DotNetSpeech.SpFileStream SFS = new DotNetSpeech.SpFileStreamClass();
SFS.Open(SFD.FileName, SSFM, false);
vo.AudioOutputStream = SFS;
vo.Speak((string)obj.GetData(DataFormats.Text), SSF);
vo.WaitUntilDone(System.Threading.Timeout.Infinite);
SFS.Close();
}
SpeechVoiceSpeakFlags SpFlags = SpeechVoiceSpeakFlags.SVSFDefault;
SpVoice Voice = new SpVoice(); Voice.Speak(read, SpFlags);http://blog.csdn.net/virlene/archive/2007/03/15/1529844.aspx