C#使用System.Speech制作语音提示功能
2018-03-29 12:11
676 查看
c#实现语音阅读以及文本转语音文件是基于c#的一个类库(SpeechSynthesizer )实现的
1.添加引用:
使用该类必须要添加引用using System.Speech.Synthesis
直接是无法添加引用的,先对项目进行添加引用
2.语音朗读
SpeechSynthesizer synth = new SpeechSynthesizer();
美式发音,但只能读英文:synth.SelectVoice(“Microsoft Anna”);
能读中英文:synth.SelectVoice(“Microsoft Lili”);
synth.Speak(str);
3.语音识别
SpeechRecognitionEngine sre = new SpeechRecognitionEngine();
1.添加引用:
使用该类必须要添加引用using System.Speech.Synthesis
直接是无法添加引用的,先对项目进行添加引用
2.语音朗读
SpeechSynthesizer synth = new SpeechSynthesizer();
美式发音,但只能读英文:synth.SelectVoice(“Microsoft Anna”);
能读中英文:synth.SelectVoice(“Microsoft Lili”);
synth.Speak(str);
3.语音识别
SpeechRecognitionEngine sre = new SpeechRecognitionEngine();
using System; using System.Speech.Synthesis; //用于语音朗读 using System.Speech.Recognition;//用于识别语音 namespace ConsoleApplication1 { class Program { static void Main(string[] args) { while (true) { Console.WriteLine("请输入中英文:"); string s = Console.ReadLine(); SpeechSynthesizer synth = new SpeechSynthesizer(); //选择不同的发音 //synth.SelectVoice("Microsoft Anna");//美式发音,但只能读英文 synth.SelectVoice("Microsoft Lili");//能读中英文 synth.Speak(s); } //语音识别 //SpeechRecognitionEngine sre = new SpeechRecognitionEngine(); } } }
相关文章推荐
- C#使用System.Speech制作语音提示功能。
- 使用AVSpeechSynthesizer添加"文本转语音"的功能
- C# System.IO.FileStream 读取被其他程序打开的文件提示“文件正由另一进程使用,因此该进程无法访问该文件。”
- C#使用VS2005制作水晶报表 提示注册 解决方法
- C#使用FileSystemWatcher控件实现的文件监控功能示例
- C#使用 System.Net.Mail发送邮件功能
- C# System.IO.FileStream 读取被其他程序打开的文件提示“文件正由另一进程使用,因此该进程无法访问该文件。”
- C#之使用NotifyIcon实现任务栏托盘菜单,图标闪烁效果及气泡提示 很多程序是只需要后台运行的,甚至不需要自己的应用界面。NotifyIcon提供了程序在任务栏的显示功能 程序下载链接如下
- Android联合第三方实现使用TextToSpeech实现语音朗读的功能
- 使用x-webkit-speech令网站支持语音输入功能
- C# System.IO.FileStream 读取被其他程序打开的文件提示“文件正由另一进程使用,因此该进程无法访问该文件。”
- C#使用 System.Net.Mail发送邮件功能
- win7 C#程序调用 System.Speech.Synthesis 提示 No voice installed on the system
- C#使用FileSystemWatcher控件实现的文件监控功能示例
- C#使用System.Timers.Timer类实现一个Button锁定功能(windows form)
- 在C#中实现打印功能(C#中PrintDialog,PrintDocument的使用)
- C#实现SMTP服务器,使用TCP命令实现,功能比较完善
- 使用.NET自带的功能制作简单的注册码
- C#中windows程序使用播放功能
- 在C#中实现打印功能(C#中PrintDialog,PrintDocument的使用)