资源简介
本案例调用科大讯飞开放接口实现了语音合成,识别,录音,以及语音朗读功能。有界面,可运行。windows应用程序
代码片段和文件信息
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 iFlyDotNet;
using NAudio.Wave;
using Microsoft.DirectX.DirectSound;
namespace demoTTS
{
public partial class Form1 : Form
{
bool luyin = true;
WaveInStream wi;
private WaveFileWriter writer;
iFlyISR isr;
public Form1()
{
InitializeComponent();
}
private void button1_Click(object sender EventArgs e)
{
button1.Enabled = false;
string c1 = “appid=53f4099e“;
iFlyTTS tts = new iFlyTTS(c1);
tts.Finished += tts_Finished;
tts.vol = enuVol.x_loud;
tts.speed = enuSpeed.medium;
tts.speeker = (enuSpeeker)comboBox1.SelectedIndex;
tts.MultiSpeek(textBox1.Text “audio.wav“);
button1.Enabled = true;
}
void tts_Finished(object sender iFlyTTS.JinDuEventArgs e)
{
System.Diagnostics.Debug.WriteLine(e.AllP.ToString());
}
private void Form1_Load(object sender EventArgs e)
{
foreach (string s in Enum.GetNames(typeof(enuSpeeker)))
comboBox1.Items.Add(s);
comboBox1.SelectedIndex = 0;
}
private void button2_Click(object sender EventArgs e)
{
button2.Enabled = false;
string c1 = “server_url=dev.voicecloud.cnappid=53f4099etimeout=10000“;
string c2 = “sub=iatssm=1auf=audio/L16;rate=16000aue=speexent=sms16krst=plain“;
isr = new iFlyISR(c1 c2);
isr.DataArrived += new EventHandler(asr_DataAvailable);
isr.ISREnd += new EventHandler(Isr_ISREnd);
isr.Audio2TxtAsync(“audio.wav“ null);
}
void Isr_ISREnd(object sender EventArgs e)
{
button2.Invoke(new MethodInvoker(delegate() { button2.Enabled = true; }));
}
void asr_DataAvailable(object sender iFlyISR.DataArrivedEventArgs e)
{
textBox1.Invoke(new MethodInvoker(delegate() { textBox1.AppendText(e.result); }));
}
private void button3_Click(object sender EventArgs e)
{
if (luyin)
{
luyin = false;
//wi = new WaveInStream(0 new WaveFormat(16000 16 1) this);
//wi.DataAvailable += new EventHandler(wi_DataAvailable);
//writer = new WaveFileWriter(“audio.wav“ wi.WaveFormat);
//wi.StartRecording();
string c1 = “server_url=dev.voicecloud.cnappid=53f4099etimeout=10000“;
string c2 = “sub=iatssm=1auf=audio/L16;rate=16000aue=speexent=sms16krst=plain“;
属性 大小 日期 时间 名称
----------- --------- ---------- ----- ----
目录 0 2018-03-19 10:06 (讯飞语音)iFlyTTS\
目录 0 2016-10-08 19:27 (讯飞语音)iFlyTTS\iFlyTTS\
目录 0 2013-01-14 07:50 (讯飞语音)iFlyTTS\iFlyTTS\demoTTS\
文件 5214 2011-11-25 16:23 (讯飞语音)iFlyTTS\iFlyTTS\demoTTS\Form1.Designer.cs
文件 4048 2014-08-20 15:57 (讯飞语音)iFlyTTS\iFlyTTS\demoTTS\Form1.cs
文件 5817 2011-11-25 16:23 (讯飞语音)iFlyTTS\iFlyTTS\demoTTS\Form1.resx
文件 488 2011-11-04 10:05 (讯飞语音)iFlyTTS\iFlyTTS\demoTTS\Program.cs
目录 0 2011-12-15 15:20 (讯飞语音)iFlyTTS\iFlyTTS\demoTTS\Properties\
文件 1346 2011-11-04 10:05 (讯飞语音)iFlyTTS\iFlyTTS\demoTTS\Properties\AssemblyInfo.cs
文件 2854 2013-01-23 10:59 (讯飞语音)iFlyTTS\iFlyTTS\demoTTS\Properties\Resources.Designer.cs
文件 5612 2011-11-04 10:05 (讯飞语音)iFlyTTS\iFlyTTS\demoTTS\Properties\Resources.resx
文件 1107 2013-01-23 10:59 (讯飞语音)iFlyTTS\iFlyTTS\demoTTS\Properties\Settings.Designer.cs
文件 249 2011-11-04 10:05 (讯飞语音)iFlyTTS\iFlyTTS\demoTTS\Properties\Settings.settings
文件 159 2013-01-23 10:59 (讯飞语音)iFlyTTS\iFlyTTS\demoTTS\app.config
目录 0 2011-12-15 15:20 (讯飞语音)iFlyTTS\iFlyTTS\demoTTS\bin\
目录 0 2016-10-08 19:26 (讯飞语音)iFlyTTS\iFlyTTS\demoTTS\bin\Debug\
文件 243496 2008-05-17 11:14 (讯飞语音)iFlyTTS\iFlyTTS\demoTTS\bin\Debug\Microsoft.DirectX.DirectSound.dll
文件 326440 2008-05-17 11:14 (讯飞语音)iFlyTTS\iFlyTTS\demoTTS\bin\Debug\Microsoft.DirectX.dll
文件 310272 2008-06-26 06:59 (讯飞语音)iFlyTTS\iFlyTTS\demoTTS\bin\Debug\NAudio.dll
文件 745004 2014-08-20 16:10 (讯飞语音)iFlyTTS\iFlyTTS\demoTTS\bin\Debug\audio.wav
文件 11776 2016-10-08 19:25 (讯飞语音)iFlyTTS\iFlyTTS\demoTTS\bin\Debug\demoTTS.exe
文件 159 2013-01-23 10:59 (讯飞语音)iFlyTTS\iFlyTTS\demoTTS\bin\Debug\demoTTS.exe.config
文件 34304 2016-10-08 19:25 (讯飞语音)iFlyTTS\iFlyTTS\demoTTS\bin\Debug\demoTTS.pdb
文件 11600 2016-10-08 19:25 (讯飞语音)iFlyTTS\iFlyTTS\demoTTS\bin\Debug\demoTTS.vshost.exe
文件 159 2013-01-23 10:59 (讯飞语音)iFlyTTS\iFlyTTS\demoTTS\bin\Debug\demoTTS.vshost.exe.config
文件 490 2010-03-17 22:39 (讯飞语音)iFlyTTS\iFlyTTS\demoTTS\bin\Debug\demoTTS.vshost.exe.manifest
目录 0 2013-01-14 07:56 (讯飞语音)iFlyTTS\iFlyTTS\demoTTS\bin\Debug\f2973f3705180a753e51c71480ee645e\
文件 8 2013-01-14 13:50 (讯飞语音)iFlyTTS\iFlyTTS\demoTTS\bin\Debug\f2973f3705180a753e51c71480ee645e\usr.dat
文件 78336 2016-10-08 19:25 (讯飞语音)iFlyTTS\iFlyTTS\demoTTS\bin\Debug\iFlyDotNet.dll
文件 34304 2016-10-08 19:25 (讯飞语音)iFlyTTS\iFlyTTS\demoTTS\bin\Debug\iFlyDotNet.pdb
文件 364544 2011-08-18 10:43 (讯飞语音)iFlyTTS\iFlyTTS\demoTTS\bin\Debug\msc.dll
............此处省略71个文件信息
- 上一篇:超级玛丽奔跑跳跃微信小游戏源代码
- 下一篇:unity最新录屏插件
评论
共有 条评论