一个有趣的东西,今后可能用得上。

C#语音识别:在命名空间 System.Speech下SpeechSynthesizer可以将文字转换成语音

贴出代码:

public partial class Form1 : Form
{
private SpeechSynthesizer ss;
public Form1()
{
InitializeComponent();
} private void Form1_Load(object sender, EventArgs e)
{
ss = new SpeechSynthesizer();
} private void button1_Click(object sender, EventArgs e)
{
ss.Rate = trackbarSpeed.Value;
ss.Volume = trackbarVoice.Value;
ss.SpeakAsync(txtSpeechText.Text);
} private void button2_Click(object sender, EventArgs e)
{
ss.Pause();
} private void button3_Click(object sender, EventArgs e)
{
ss.Resume();
} private void button4_Click(object sender, EventArgs e)
{
SpeechSynthesizer ss = new SpeechSynthesizer();
ss.Rate = trackbarSpeed.Value;
ss.Volume = trackbarVoice.Value;
SaveFileDialog savefd = new SaveFileDialog();
savefd.Filter = "wave Files|*.wav";
ss.SetOutputToWaveFile(savefd.FileName);
ss.Speak(txtSpeechText.Text);
ss.SetOutputToDefaultAudioDevice();
MessageBox.Show("完成录音~~~", "提示");
} private void button5_Click(object sender, EventArgs e)
{
Application.Exit();
}
}

【C#】语音识别 - System.Speech的更多相关文章

  1. C#的语音识别 using System.Speech.Recognition;

    using System; using System.Collections.Generic; using System.Linq; using System.Speech.Recognition; ...

  2. C#中的System.Speech命名空间初探

    本程序是口算两位数乘法,随机生成两个两位数,用语音读出来.然后开启语音识别,接受用户输入,知道答案正确关闭语音识别.用户说答案时,可以说“再说一遍”重复题目. 关键是GrammarBuilder和Ch ...

  3. C# 使用System.Speech 进行语音播报和识别

    C# 使用System.Speech 进行语音播报和识别 using System.Speech.Synthesis; using System.Speech.Recognition; //语音识别 ...

  4. System.Speech.Synthesis 添加暂停、继续功能

    为了方便调用暂停.继续的方法.要将speech的功能写成一个类.直接附上代码: using System; using System.Collections.Generic; using System ...

  5. asp.net引用System.Speech实现语音提示

    using System; using System.Speech.Synthesis; namespace testvoice { class Program { static void Main( ...

  6. System.Speech使用

    使用微软语音库 使用微软语音库可以很快速的制作一个小应用,比如一个唐诗的朗诵工具.本示例也是使用微软语音库,制作了一个唐诗宋词朗诵的应用,仅供加深学习印象 首先是要引入System.Speech库 然 ...

  7. python之语音识别(speech模块)

    1.原理 语音操控分为 语音识别和语音朗读两部分. 这两部分本来是需要自然语言处理技能相关知识以及一系列极其复杂的算法才能搞定,可是这篇文章将会跳过此处,如果你只是对算法和自然语言学感兴趣的话,就只有 ...

  8. C# ms speech文字转语音例子

    最近突发奇想 想玩玩  文字转语音的东东   谷歌了一下 发现微软有一个TTS 的SDK   查了查相关资料  发现 还真不错  然后就开始玩玩Microsoft Speech SDK的 DEMO了 ...

  9. 玩一下C#的语音识别

    在.NET4.0中,我可以借助System.Speech组件让电脑来识别我们的声音. 以上,当我说"name",显示"Darren",我说"age&q ...

随机推荐

  1. 2018.4.23 pip使用

    pip打包 python setup.py check  检查setup.py是不是正确,如果正确就只输出running check python setup.py dist  会将项目打包成一个ta ...

  2. 实验吧—Web——WP之 上传绕过

    我们先上传一个png文件,发现他说必须上传后缀名为PHP的文件才可以,那么,我们尝试一下,PHP文件 但是他又说不被允许的文件类型 在上传绕过里最有名的的就是00截断,那么我们就先要抓包 在这里我们需 ...

  3. stm32l071cbt6片内flash操作

    今天在看片内flash的操作,发现按照下面的操作并没有写成功: unsigned long temp = 0x12345678; HAL_FLASH_Unlock(); FLASH_PageErase ...

  4. 取消svn关联文件夹

    svn没有自带取消svn关联功能,所以我们需要以下脚本 Windows Registry Editor Version 5.00 [HKEY_LOCAL_MACHINE\SOFTWARE\Classe ...

  5. Android学习--------实现增删改查数据库操作以及实现相似微信好友对话管理操作

    版权声明:本文为博主原创文章,转载请注明原文地址.谢谢~ https://blog.csdn.net/u011250851/article/details/26169409 近期的一个实验用到东西挺多 ...

  6. touch-action 解决移动端300ms延迟问题

    CSS3 新属性, touch-action: manipulation; 可以有效的解决移动端300ms延迟的问题 移动端300ms延迟问题一直都是h5APP的痛点, 有很多库或者方法都可以解决, ...

  7. webpack 的 入口(Entry)、输出(Output)

    入口(Entry) 入口定义了我们的应用代码开始执行的那个文件,webpack从这个文件开始打包.你能定义一个入口点(常见于单页应用 - Single-Page Application), 或者多个入 ...

  8. Jmeter--报错 WARNING: Could not open/create prefs root node Software\JavaSoft\Prefs at root 0x80000002. Windows RegCreateKeyEx(...) returned error code 5.

    今天要用Jmeter测试服务器性能,发现GUI界面总是有warning提示: WARNING: Could not open/create prefs root node Software\JavaS ...

  9. RHEL 6.5系统安装配置图解教程(rhel-server-6.5)

    转自:http://www.jb51.NET/os/128752.html 说明: 截止目前RHEL 6.x最新版本为RHEL 6.5,下面介绍RHEL 6.5的具体安装配置过程 服务器相关设置如下: ...

  10. Ubuntu中编译helloworld驱动

    1. 新建hello文件夹 2.hello.c #ifndef __KERNEL__ # define __KERNEL__ #endif #ifndef MODULE # define MODULE ...