C# 实现Text to Speech
2009-09-02 15:35
381 查看
Windows Speech SDK 5.1 下载链接 http://www.microsoft.com/downloads/details.aspx?FamilyID=5e86ec97-40a7-453f-b0ee-6583171b4530&displaylang=en
需要下载文件:
SpeechSDK51.exe (开发包)和 SpeechSDK51LangPack.exe(语言包)
API引用
GUI设计
后台Code:
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 SpeechLib;
namespace TTSApplication
{
public partial class Form1 : Form
{
SpeechVoiceSpeakFlags SpFlags;
SpVoice voice;
public Form1()
{
InitializeComponent();
SpFlags = SpeechVoiceSpeakFlags.SVSFlagsAsync;
voice = new SpVoice();
}
private void Speakerbutton_Click(object sender, EventArgs e)
{
string content = ContenttextBox.Text;
try
{
voice.Speak(content.Length > 0 ? content : "请输入朗读内容", SpFlags);
}
catch(Exception ex)
{
MessageBox.Show(ex.ToString());
}
}
private void Cancelbutton_Click(object sender, EventArgs e)
{
Dispose();
Close();
}
private void RatetrackBar_Scroll(object sender, EventArgs e)
{
voice.Rate = RatetrackBar.Value;
}
private void VolumntrackBar_Scroll(object sender, EventArgs e)
{
voice.Volume = VolumntrackBar.Value;
}
}
}
主要实现 机器朗读文本框中的内容,可以调节朗读语速和声音。
需要下载文件:
SpeechSDK51.exe (开发包)和 SpeechSDK51LangPack.exe(语言包)
API引用
GUI设计
后台Code:
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 SpeechLib;
namespace TTSApplication
{
public partial class Form1 : Form
{
SpeechVoiceSpeakFlags SpFlags;
SpVoice voice;
public Form1()
{
InitializeComponent();
SpFlags = SpeechVoiceSpeakFlags.SVSFlagsAsync;
voice = new SpVoice();
}
private void Speakerbutton_Click(object sender, EventArgs e)
{
string content = ContenttextBox.Text;
try
{
voice.Speak(content.Length > 0 ? content : "请输入朗读内容", SpFlags);
}
catch(Exception ex)
{
MessageBox.Show(ex.ToString());
}
}
private void Cancelbutton_Click(object sender, EventArgs e)
{
Dispose();
Close();
}
private void RatetrackBar_Scroll(object sender, EventArgs e)
{
voice.Rate = RatetrackBar.Value;
}
private void VolumntrackBar_Scroll(object sender, EventArgs e)
{
voice.Volume = VolumntrackBar.Value;
}
}
}
主要实现 机器朗读文本框中的内容,可以调节朗读语速和声音。
相关文章推荐
- 使用Svox实现中文转语音TextToSpeech(TTS)
- 使用Svox实现中文转语音TextToSpeech(TTS)
- android自学之TextToSpeech实现文字向语音的转换
- 使用安卓中的TextToSpeech控件实现朗读文字
- Android联合第三方实现使用TextToSpeech实现语音朗读的功能
- 利用Google Speech API实现Speech To Text
- 使用C#进行语音识别(Speech-to-Text)
- java的TTS(Text to Speech)的实现
- C# Speech to Text
- 使用安卓中的TextToSpeech控件实现朗读文字
- android自学之TextToSpeech例子实现将文字转化为语音功能
- 利用Google Speech API实现Speech To Text
- 用封装的思想实现TTs(Text-to-Speech)
- 使用TextToSpeech实现文本转音频(自动朗读)
- 配置Speech-to-Text-WaveNet
- 必应语音API(Bing text to speech API)
- Android中的TextToSpeech 将文本转换成语音的简单使用。
- C# 实现list=list.OrderBy(q=>q.字段名).ToList(); 按多个字段排序
- 在C++Builder使用TTS(Text To Speech)
- 转-支付宝Payto接口的c#.net实现