资源简介
由于科大讯飞的语音开发包是基于C++开发的,因此用c#进行相应的开发,需要二次封装该DLL,该代码实现了TTS的封装,可编译运行
代码片段和文件信息
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
namespace SpVoiceDemo
{
public partial class frmMain : Form
{
public frmMain()
{
InitializeComponent();
comboBox1.DropDownstyle = ComboBoxstyle.DropDownList;
}
SpVoiceUtil SpVoiceUtil = new SpVoiceUtil();
private void frmMain_Load(object sender EventArgs e)
{
Control.CheckForIllegalCrossThreadCalls = false;
List list = SpVoiceUtil.getDescription();
foreach (var item in list)
{
comboBox1.Items.Add(item);
}
if (comboBox1.Items.Count > 0)
{
comboBox1.SelectedIndex = 0;
}
}
private void comboBox1_SelectedIndexChanged(object sender EventArgs e)
{
SpVoiceUtil.setDescription(this.Text);
}
//暂停
private void button2_Click(object sender EventArgs e)
{
SpVoiceUtil.Pause();
}
//继续
private void button5_Click(object sender EventArgs e)
{
SpVoiceUtil.Resume();
}
//停止
private void button3_Click(object sender EventArgs e)
{
SpVoiceUtil.Stop();
}
//设置语速
private void trackBar1_Scroll(object sender EventArgs e)
{
lab_Rate.Text = trackBar1.Value.ToString();
SpVoiceUtil.setRate(trackBar1.Value);
}
//设置音量
private void trackBar2_Scroll(object sender EventArgs e)
{
lab_Volume.Text = trackBar2.Value.ToString();
SpVoiceUtil.setVolume(trackBar2.Value);
}
//开始朗读
private void button1_Click(object sender EventArgs e)
{
SpVoiceUtil.Speak(txt_str.Text CallBack);
}
//写出WAV
private void button4_Click(object sender EventArgs e)
{
SpVoiceUtil.WreiteToWAV(@“C:\\1.wav“ txt_str.Text DotNetSpeech.SpeechAudioFormatType.SAFT11kHz16BitMono);
}
//回调信息
private void CallBack(bool b int InputWordPosition int InputWordLength)
{
textBox1.AppendText(“是否读完:“+b.ToString()+“\r\n“);
textBox1.AppendText(“朗读长度:“ + InputWordPosition.ToString() + “\r\n“);
textBox1.AppendText(“朗读位置:“ + InputWordLength.ToString() + “\r\n“);
}
}
}
属性 大小 日期 时间 名称
----------- --------- ---------- ----- ----
..A..H. 45056 2018-02-26 16:40 SpVoice\.vs\SpVoice\v14\.suo
文件 163840 2011-02-16 17:07 SpVoice\SpVoice\bin\Debug\DotNetSpeech.dll
文件 16896 2018-02-26 13:45 SpVoice\SpVoice\bin\Debug\SpVoice.exe
文件 30208 2018-02-26 13:45 SpVoice\SpVoice\bin\Debug\SpVoice.pdb
文件 21688 2018-02-26 16:40 SpVoice\SpVoice\bin\Debug\SpVoice.vshost.exe
文件 490 2016-07-16 19:44 SpVoice\SpVoice\bin\Debug\SpVoice.vshost.exe.manifest
文件 2735 2013-01-30 06:31 SpVoice\SpVoice\frmMain.cs
文件 10843 2013-01-30 06:31 SpVoice\SpVoice\frmMain.Designer.cs
文件 7639 2013-01-30 06:31 SpVoice\SpVoice\frmMain.resx
文件 6211 2018-02-26 13:45 SpVoice\SpVoice\obj\x86\Debug\DesignTimeResolveAssemblyReferencesInput.cache
文件 3672 2013-01-30 06:24 SpVoice\SpVoice\obj\x86\Debug\ResGen.read.1.tlog
文件 1848 2013-01-30 06:24 SpVoice\SpVoice\obj\x86\Debug\ResGen.write.1.tlog
文件 2634 2013-01-30 02:55 SpVoice\SpVoice\obj\x86\Debug\ResolveAssemblyReference.cache
文件 679 2013-01-30 02:29 SpVoice\SpVoice\obj\x86\Debug\SpVoice.csproj.FileListAbsolute.txt
文件 16896 2018-02-26 13:45 SpVoice\SpVoice\obj\x86\Debug\SpVoice.exe
文件 985 2013-01-30 02:29 SpVoice\SpVoice\obj\x86\Debug\SpVoice.frmMain.resources
文件 30208 2018-02-26 13:45 SpVoice\SpVoice\obj\x86\Debug\SpVoice.pdb
文件 180 2013-01-30 02:29 SpVoice\SpVoice\obj\x86\Debug\SpVoice.Properties.Resources.resources
文件 1323 2018-02-26 16:40 SpVoice\SpVoice\obj\x86\Debug\SpVoiceDemo.csproj.FileListAbsolute.txt
文件 849 2018-02-26 13:45 SpVoice\SpVoice\obj\x86\Debug\SpVoiceDemo.csproj.GenerateResource.Cache
文件 4272 2018-02-26 13:45 SpVoice\SpVoice\obj\x86\Debug\SpVoiceDemo.csprojResolveAssemblyReference.cache
文件 1959 2018-02-26 13:45 SpVoice\SpVoice\obj\x86\Debug\SpVoiceDemo.frmMain.resources
文件 180 2018-02-26 13:45 SpVoice\SpVoice\obj\x86\Debug\SpVoiceDemo.Properties.Resources.resources
文件 4608 2013-01-30 02:49 SpVoice\SpVoice\obj\x86\Debug\TempPE\Properties.Resources.Designer.cs.dll
文件 474 2013-01-30 02:35 SpVoice\SpVoice\Program.cs
文件 1346 2013-01-30 02:13 SpVoice\SpVoice\Properties\AssemblyInfo.cs
文件 2860 2013-01-30 02:35 SpVoice\SpVoice\Properties\Resources.Designer.cs
文件 5612 2013-01-30 02:13 SpVoice\SpVoice\Properties\Resources.resx
文件 1109 2013-01-30 02:35 SpVoice\SpVoice\Properties\Settings.Designer.cs
文件 249 2013-01-30 02:13 SpVoice\SpVoice\Properties\Settings.settings
............此处省略20个文件信息
- 上一篇:基于导向滤波和人脸检测的美颜算法
- 下一篇:C++遗传算法 解决01背包问题 注释全
评论
共有 条评论