DotNetSpeech.dll的使用
語(yǔ)音是人類最自然的交互方式,也是現(xiàn)階段軟件用戶界面發(fā)展的最高目標(biāo)。微軟公司一直積極推動(dòng)語(yǔ)音技術(shù)的發(fā)展,并且公布了語(yǔ)音開(kāi)發(fā)平臺(tái)Speech SDK幫助開(kāi)發(fā)人員實(shí)現(xiàn)語(yǔ)音應(yīng)用。
using System;
using System.Drawing;
using System.Collections;
using System.ComponentModel;
using System.Windows.Forms;
using System.Data;
using DotNetSpeech;
namespace SpeechApp
{
/// <summary>
/// Form1 的摘要說(shuō)明。
/// </summary>
public class Form1 : System.Windows.Forms.Form
{
private System.Windows.Forms.GroupBox groupBox1;
private System.Windows.Forms.TextBox textBox1;
private System.Windows.Forms.Button ButtonSynthesis;
private System.Windows.Forms.Button ButtonTTStoWave;
/// <summary>
/// 必需的設(shè)計(jì)器變量。
/// </summary>
private System.ComponentModel.Container components = null;
public Form1()
{
//
// Windows 窗體設(shè)計(jì)器支持所必需的
//
InitializeComponent();
//
// TODO: 在 InitializeComponent 調(diào)用后添加任何構(gòu)造函數(shù)代碼
//
}
/// <summary>
/// 清理所有正在使用的資源。
/// </summary>
protected override void Dispose( bool disposing )
{
if( disposing )
{
if (components != null)
{
components.Dispose();
}
}
base.Dispose( disposing );
}
#region Windows 窗體設(shè)計(jì)器生成的代碼
/// <summary>
/// 設(shè)計(jì)器支持所需的方法 - 不要使用代碼編輯器修改
/// 此方法的內(nèi)容。
/// </summary>
private void InitializeComponent()
{
this.groupBox1 = new System.Windows.Forms.GroupBox();
this.textBox1 = new System.Windows.Forms.TextBox();
this.ButtonSynthesis = new System.Windows.Forms.Button();
this.ButtonTTStoWave = new System.Windows.Forms.Button();
this.groupBox1.SuspendLayout();
this.SuspendLayout();
//
// groupBox1
//
this.groupBox1.Controls.Add(this.textBox1);
this.groupBox1.Location = new System.Drawing.Point(8, 8);
this.groupBox1.Name = "groupBox1";
this.groupBox1.Size = new System.Drawing.Size(272, 144);
this.groupBox1.TabIndex = 0;
this.groupBox1.TabStop = false;
this.groupBox1.Text = "請(qǐng)輸入要合成的文本";
//
// textBox1
//
this.textBox1.Location = new System.Drawing.Point(8, 24);
this.textBox1.Multiline = true;
this.textBox1.Name = "textBox1";
this.textBox1.Size = new System.Drawing.Size(256, 112);
this.textBox1.TabIndex = 0;
this.textBox1.Text = "歡迎光臨Lion互動(dòng)網(wǎng)絡(luò)";
//
// ButtonSynthesis
//
this.ButtonSynthesis.CausesValidation = false;
this.ButtonSynthesis.FlatStyle = System.Windows.Forms.FlatStyle.Popup;
this.ButtonSynthesis.Location = new System.Drawing.Point(24, 160);
this.ButtonSynthesis.Name = "ButtonSynthesis";
this.ButtonSynthesis.TabIndex = 1;
this.ButtonSynthesis.Text = "朗 讀";
this.ButtonSynthesis.Click += new System.EventHandler(this.ButtonSynthesis_Click);
//
// ButtonTTStoWave
//
this.ButtonTTStoWave.CausesValidation = false;
this.ButtonTTStoWave.FlatStyle = System.Windows.Forms.FlatStyle.Popup;
this.ButtonTTStoWave.Location = new System.Drawing.Point(128, 160);
this.ButtonTTStoWave.Name = "ButtonTTStoWave";
this.ButtonTTStoWave.Size = new System.Drawing.Size(136, 23);
this.ButtonTTStoWave.TabIndex = 2;
this.ButtonTTStoWave.Text = "生成聲音文件(WAV)";
this.ButtonTTStoWave.Click += new System.EventHandler(this.ButtonTTStoWave_Click);
//
// Form1
//
this.AutoScaleBaseSize = new System.Drawing.Size(6, 14);
this.ClientSize = new System.Drawing.Size(292, 191);
this.Controls.Add(this.ButtonTTStoWave);
this.Controls.Add(this.ButtonSynthesis);
this.Controls.Add(this.groupBox1);
this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedSingle;
this.Name = "Form1";
this.Text = "歡迎光臨Lion互動(dòng)網(wǎng)絡(luò)";
this.groupBox1.ResumeLayout(false);
this.ResumeLayout(false);
}
#endregion
/// <summary>
/// 應(yīng)用程序的主入口點(diǎn)。
/// </summary>
[STAThread]
static void Main()
{
Application.Run(new Form1());
}
/// <summary>
/// 朗讀
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
private void ButtonSynthesis_Click(object sender, System.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);
}
}
/// <summary>
/// 生成聲音文件
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
private void ButtonTTStoWave_Click(object sender, System.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);
}
}
}
}
- PC官方版
- 安卓官方手機(jī)版
- IOS官方手機(jī)版















下載
下載
下載
下載
下載
下載
oelove婚戀交友系統(tǒng)v8.1 十周年版
sqltoy-orm框架v4.18.13最新版
flutter聊天源碼開(kāi)源完整版
最新版抖商精靈源碼4.1暖場(chǎng)升級(jí)版
完整版經(jīng)典C#WinForm實(shí)例源碼共200個(gè)
android5使用poi讀取excel源代碼
香程互贊寶源碼免授權(quán)版
百度小程序轉(zhuǎn)微信小程序1.0 最新免費(fèi)版
BCM文件轉(zhuǎn)換工具(BCM源碼格式化)2.7.2 簡(jiǎn)體中文版
易語(yǔ)言資源網(wǎng)源碼下載工具1.0 中文免費(fèi)版
縮狗圖床源碼免費(fèi)版
24個(gè)c++游戲源碼完整版
嵌入式圖像處理C語(yǔ)言源碼免費(fèi)下載
騰訊AI語(yǔ)音合成源碼最新免費(fèi)版
DSShop單用戶B2C開(kāi)源PHP商城系統(tǒng)TP框架1.6 最新版
易之源(最好的源碼解析工具)v1.0 免費(fèi)版
妖氣山視頻管理系統(tǒng)源碼免費(fèi)下載
魔性機(jī)器人網(wǎng)頁(yè)代碼免費(fèi)下載
凈網(wǎng)小助手源碼2.2.1 最新完整版
易語(yǔ)言源碼誤刪恢復(fù)器1.0 官方版
微擎微贊一物一碼抽獎(jiǎng)模塊源碼最新完整版
微信小程序模板源碼50個(gè)實(shí)用程序
Android poi 操作doc excel pdf
Amoli私有云4.2.2 2019.08.08 最新版
LaySNS輕社區(qū)系統(tǒng)2.55 最新版
可可網(wǎng)絡(luò)驗(yàn)證系統(tǒng)9.5 官方版
源碼編輯器軟件3.4.13 電腦版
Activiti(開(kāi)源bpm軟件)6.0.0 官方最新版
悟空crm系統(tǒng)源碼9.0_20191202 官方最新版
帝國(guó)網(wǎng)站管理系統(tǒng)7.5.0 官網(wǎng)正式版





Android Studio 源碼2.4 免費(fèi)下載
浮夢(mèng)QQ工具箱易語(yǔ)言源碼1.0免費(fèi)版
易語(yǔ)言電腦開(kāi)機(jī)自動(dòng)拍照發(fā)指定郵箱源碼5.5
ECSHOP家居網(wǎng)上商城模塊源碼2.7.2免費(fèi)暢享版
CF狄克改槍源碼免費(fèi)打包下載
仿騰訊新聞門戶網(wǎng)站管理系統(tǒng)模板源碼v2.0 正
mpycQQ機(jī)器人插件源碼2016 最新版
似水年華同學(xué)錄破解版2.2 正式版php源碼
UCKeFu客戶支持服務(wù)平臺(tái)源碼1.2.0 免費(fèi)下載