资源简介
研究了一下C#的文本语音朗读,写了一个小demo,在32位win7下可以运行朗读,还可以将朗读保存WAV,,,大家可以参考参考
代码片段和文件信息
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using DotNetSpeech;
namespace SpeechApp
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
///
/// 朗读
///
///
///
private void ButtonSynthesis_Click(object sender EventArgs e)
{
try
{
DotNetSpeech.SpeechVoiceSpeakFlags SSF = DotNetSpeech.SpeechVoiceSpeakFlags.SVSFlagsAsync;
DotNetSpeech.SpVoice vo = new SpVoiceClass();
vo.Speak(this.textBox1.Text SSF);
}
catch (System.Exception ec)
{
MessageBox.Show(ec.ToString() “SpeechApp“ MessageBoxButtons.OK System.Windows.Forms.MessageBoxIcon.Error);
}
}
///
/// 生成声音文件
///
///
///
private void ButtonTTStoWave_Click(object sender EventArgs e)
{
try
{
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();
}
}
catch (System.Exception ec)
{
MessageBox.Show(ec.ToString() “SpeechApp“ MessageBoxButtons.OK System.Windows.Forms.MessageBoxIcon.Error);
}
}
}
}
属性 大小 日期 时间 名称
----------- --------- ---------- ----- ----
文件 163840 2017-02-22 14:32 SpeechApp\SpeechApp\bin\Debug\DotNetSpeech.dll
文件 9728 2017-02-22 16:05 SpeechApp\SpeechApp\bin\Debug\SpeechApp.exe
文件 26112 2017-02-22 16:05 SpeechApp\SpeechApp\bin\Debug\SpeechApp.pdb
文件 11608 2017-02-22 16:08 SpeechApp\SpeechApp\bin\Debug\SpeechApp.vshost.exe
文件 490 2010-03-17 22:39 SpeechApp\SpeechApp\bin\Debug\SpeechApp.vshost.exe.manifest
文件 2701 2017-02-22 16:05 SpeechApp\SpeechApp\Form1.cs
文件 3463 2017-02-22 16:05 SpeechApp\SpeechApp\Form1.Designer.cs
文件 5817 2017-02-22 16:05 SpeechApp\SpeechApp\Form1.resx
文件 6278 2017-02-22 16:05 SpeechApp\SpeechApp\obj\x86\Debug\DesignTimeResolveAssemblyReferencesInput.cache
文件 566 2017-02-22 16:05 SpeechApp\SpeechApp\obj\x86\Debug\GenerateResource-ResGen.read.1.tlog
文件 922 2017-02-22 16:05 SpeechApp\SpeechApp\obj\x86\Debug\GenerateResource-ResGen.write.1.tlog
文件 2714 2017-02-22 16:01 SpeechApp\SpeechApp\obj\x86\Debug\ResolveAssemblyReference.cache
文件 1083 2017-02-22 16:08 SpeechApp\SpeechApp\obj\x86\Debug\SpeechApp.csproj.FileListAbsolute.txt
文件 9728 2017-02-22 16:05 SpeechApp\SpeechApp\obj\x86\Debug\SpeechApp.exe
文件 180 2017-02-22 16:05 SpeechApp\SpeechApp\obj\x86\Debug\SpeechApp.Form1.resources
文件 26112 2017-02-22 16:05 SpeechApp\SpeechApp\obj\x86\Debug\SpeechApp.pdb
文件 180 2017-02-22 16:01 SpeechApp\SpeechApp\obj\x86\Debug\SpeechApp.Properties.Resources.resources
文件 490 2017-02-22 15:56 SpeechApp\SpeechApp\Program.cs
文件 1370 2017-02-22 15:56 SpeechApp\SpeechApp\Properties\AssemblyInfo.cs
文件 2869 2017-02-22 15:56 SpeechApp\SpeechApp\Properties\Resources.Designer.cs
文件 5612 2017-02-22 15:56 SpeechApp\SpeechApp\Properties\Resources.resx
文件 1095 2017-02-22 15:56 SpeechApp\SpeechApp\Properties\Settings.Designer.cs
文件 249 2017-02-22 15:56 SpeechApp\SpeechApp\Properties\Settings.settings
文件 3816 2017-02-22 16:01 SpeechApp\SpeechApp\SpeechApp.csproj
文件 869 2017-02-22 15:56 SpeechApp\SpeechApp.sln
..A..H. 19456 2017-02-22 16:09 SpeechApp\SpeechApp.suo
目录 0 2017-02-22 15:56 SpeechApp\SpeechApp\obj\x86\Debug\TempPE
目录 0 2017-02-22 16:05 SpeechApp\SpeechApp\obj\x86\Debug
目录 0 2017-02-22 16:01 SpeechApp\SpeechApp\bin\Debug
目录 0 2017-02-22 15:56 SpeechApp\SpeechApp\obj\x86
............此处省略8个文件信息
相关资源
- 使用C#.NET实现FTP文件
- 电子邮件email收取客户端程序,C#源代
- HIKVISION工业相机通过Halcon二次开发的
- 用C#编程调用Visio的COM接口,获取Vis
- C#打印--打印商品出库单(亲测可用)
- C#实现滚动字幕完整源码(亲测可用)
- C# SqlHelper类
- 测绘编程技术——C#控制点展绘
- C#实现计算器
- C# 实现RDP远程桌面连接配套项目源码
- winform登陆界面展示
- C#TabControl控件实现窗体的整合与切换
- C#2048源码
- C#开发大全提高卷ISO镜像
- c#日期推算
- C#调用OpenCV开发简易版美图工具
- C#中隐式运行CMD命令行窗口的方法
- C#使用post发送和接收数据的方法
- C#程序优化-有效减少CPU占用率
- c# asp.net webform web页面打印可以控制需
- c#无句柄UI 思路
- AE二次开发C#程序
- 根据汉字自动生成助记码
- c#win7资源管理器
- Excel 中创建多个保存的Sheet
- C# Sftp上传文件 DiffieHellman.dll org.ment
- C#编写的道闸程序
- c#调用EXCEL宏及操作类
- C#实现本地文件保存到另一台电脑的代
-
wince下的C#读取xm
l文件
评论
共有 条评论