楼办行通现实并每公司或都能够请专业录音员录音另外字符识别算相复杂算并能读两字算功语音案般都TTS(全称英文差没记住呵呵)应用所给网址面应用调用整dll所写功能些楼主简单应用使用网流传变通我做语音所收集资料知道版权谁呵呵 本文讲述使用微软TTS5.1语音引擎(文)实现文本阅读音频输WAV完美解决案网文章说要安装SAPI.51 SDK东西几十M并且用起比较复杂微软官网站写:SAPI5.1 SDK微软网站载: 需要安装程序Speech SDK 5.1(68M)5.1 Language Pack (81.5M)本文使用2M东西实现文语转换说关TTS完美版本
功能:
进行文文本阅读阅读语音输WAV音频实现平台:
Microsoft Visual Studio 2005
微软TTS5.1语音引擎(文)所需要东西:
用TlbImpSAPI.51 SDK导DotNetSpeech.dll(160K)
微软TTS5.1语音引擎(文).msi(1.55M)两东西由于关系没传需要留邮箱址自安装SAPI.51 SDK使用命令自导DotNetSpeech.dll
Tlbimp sapi.dll /out: DotNetSpeech.dll(现错误用管影响使用)
安装微软TTS5.1语音引擎(文).msi打"控制面板"打"语音"配置项目"文字-语音转换""语音选择"组合框选择"Microsoft Simplified Chinese"才读文要读英文要选择"Microsoft Sam"
使用Microsoft Visual Studio 2005新建项目添加引用引用DotNetSpeech.dll
命名空间:
using DotNetSpeech;读文本框文:
SpeechVoiceSpeakFlags spFlags = SpeechVoiceSpeakFlags.SVSFlagsAsync;
SpVoice voice = new SpVoice();
voice.Speak(textBox1.Text, spFlags);文本框文读音保存WAV文件:
SpeechVoiceSpeakFlags spFlags = SpeechVoiceSpeakFlags.SVSFlagsAsync;
SpVoice voice = new SpVoice();
SaveFileDialog dialog = new SaveFileDialog();
dialog.Filter = "All files (*.*)|*.*|wav files (*.wav)|*.wav";
dialog.Title = "保存WAV文件";
dialog.FilterIndex = 2;
dialog.RestoreDirectory = true;
if (dialog.ShowDialog() == DialogResult.OK)
{
SpeechStreamFileMode spFileMode = SpeechStreamFileMode.SSFMCreateForWrite;
SpFileStream spFileStream = new SpFileStream();
spFileStream.Open(dialog.FileName, spFileMode, false);
voice.AudioOutputStream = spFileStream;
voice.Speak(textBox1.Text, spFlags);
voice.WaitUntilDone(1000);
面两句定要写否则产文件没声音
WaitUntilDone面smTimeoutint型
spFileStream.Close(); 参考我现用进行实语音播放我代码基本SpVoice aSpVoice = new SpVoice();…… private void VieoStr(string Vieo)
{
string iVoiceStr = ChLStr(Vieo);
while (aSpVoice.Status.RunningState != SpeechRunState.SRSEDone)
{
Thread.Sleep(100);
} if (aSpVoice.Status.RunningState == SpeechRunState.SRSEDone)
{
aSpVoice.Speak(iVoiceStr, SpeechVoiceSpeakFlags.SVSFIsXML | SpeechVoiceSpeakFlags.SVSFlagsAsync);
}
} 点要说明微软语音库能读文字非限且读东西比较硬楼主高端应用建议使用案楼主解 科讯飞 语音产品我解公司产品读东西比微软