码迷,mamicode.com
首页 > 其他好文 > 详细

文本转换成音频流

时间:2014-05-01 14:40:37      阅读:377      评论:0      收藏:0      [点我收藏+]

标签:class   ext   文件   window   name   for   new   res   file   text   os   

 

1.生成声音文件

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(this.textBox1.Text,SSF);
vo.WaitUntilDone(System.Threading.Timeout.Infinite);
SFS.Close();

2.朗读

DotNetSpeech.SpeechVoiceSpeakFlags SSF = DotNetSpeech.SpeechVoiceSpeakFlags.SVSFlagsAsync;
DotNetSpeech.SpVoice vo = new SpVoiceClass();
vo.Speak(this.textBox1.Text,SSF);

文本转换成音频流,码迷,mamicode.com

文本转换成音频流

标签:class   ext   文件   window   name   for   new   res   file   text   os   

原文地址:http://www.cnblogs.com/ChineseMoonGod/p/3700762.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!