语音播报
2015-12-25 14:29
302 查看
相关: http://blog.sina.com.cn/s/blog_45c379c001016d7u.html
DLL :
备注:
1、运行TTSrepair.exe,修护系统语音功能。(确保系统语音相关组件能正常使用)
2、添加 Interop.SpeechLib.dll 和 SpeechLib.dll
3、如无语音库,请安装“girl_xialkun.exe”(为一种语音库)
下载地址:http://download.iciba.com/pwpe/girl_xiaokun.exe
注:win7系统默认语音库为microsoft lily chinese,阉割版的系统没有相关功能
DLL :
备注:
1、运行TTSrepair.exe,修护系统语音功能。(确保系统语音相关组件能正常使用)
2、添加 Interop.SpeechLib.dll 和 SpeechLib.dll
3、如无语音库,请安装“girl_xialkun.exe”(为一种语音库)
下载地址:http://download.iciba.com/pwpe/girl_xiaokun.exe
注:win7系统默认语音库为microsoft lily chinese,阉割版的系统没有相关功能
using SpeechLib; using System; using System.Collections.Generic; using System.ComponentModel; using System.Data; using System.Drawing; using System.Linq; using System.Text; using System.Threading.Tasks; using System.Windows.Forms; using SAMPLETTSENGLib; namespace 语音播报 { public partial class Form1 : Form { public Form1() { InitializeComponent(); } private void button1_Click(object sender, EventArgs e) { //检查 if (comboBox1.SelectedIndex < 0) { MessageBox.Show("请选择语音库!", "Message", MessageBoxButtons.OK); return; } if (textBox1.Text == "") { MessageBox.Show("请在文本中输入将要读取的信息!", "Message", MessageBoxButtons.OK); return; } //执行朗读 SpeechVoiceSpeakFlags flag = SpeechVoiceSpeakFlags.SVSFlagsAsync; SpVoice sv = new SpVoice(); //用第3个语音库,根据系统所安装语音库进行选择 sv.Voice = sv.GetVoices().Item(comboBox1.SelectedIndex); sv.Speak(textBox1.Text, flag);//播放 } private void Form1_Load(object sender, EventArgs e) { //将所有语音库加载到combox List<string> lst = new List<string>(); ISpeechObjectTokens obj = new SpVoice().GetVoices(); for (int i = 0; i < obj.Count; i++) { comboBox1.Items.Add(obj.Item(i).GetDescription()); } } } }
相关文章推荐
- 数据表创建参数介绍
- 谈谈我对JavaScript中typeof和instanceof的深入理解
- StrutsPrepareAndExecuteFilter 和 FilterDispatcher的区别
- bootstrap-fileinput图片上传
- 关于CAB打包的步骤
- python中的urlencode与urldecode
- 《C++Primer 5e》学习笔记(2):字符串、向量和数组
- Swift中的基础知识总结(一)
- 使用 Docker 搭建 Java Web 运行环境
- oracle的dual表
- Detail Disclosure Button and Segues
- Sublime Text 使用介绍、全套快捷键及插件推荐
- sklearn random forest实验
- 全向天线和定向天线的差异
- 两个UIScrollView同步滚动
- CP学习笔记(10) - 并行计算
- NJKWebViewProgress ——webview进度条
- Java:Remote Debug
- volume image
- 使用反射复制一个JavaBean的对象