标签:blog http io ar for 2014 art div 代码
一个有趣的东西,今后可能用得上。
C#语音识别:在命名空间 System.Speech下SpeechSynthesizer可以将文字转换成语音
贴出代码:
public partial class Form1 : Form { private SpeechSynthesizer ss; public Form1() { InitializeComponent(); } private void Form1_Load(object sender, EventArgs e) { ss = new SpeechSynthesizer(); } private void button1_Click(object sender, EventArgs e) { ss.Rate = trackbarSpeed.Value; ss.Volume = trackbarVoice.Value; ss.SpeakAsync(txtSpeechText.Text); } private void button2_Click(object sender, EventArgs e) { ss.Pause(); } private void button3_Click(object sender, EventArgs e) { ss.Resume(); } private void button4_Click(object sender, EventArgs e) { SpeechSynthesizer ss = new SpeechSynthesizer(); ss.Rate = trackbarSpeed.Value; ss.Volume = trackbarVoice.Value; SaveFileDialog savefd = new SaveFileDialog(); savefd.Filter = "wave Files|*.wav"; ss.SetOutputToWaveFile(savefd.FileName); ss.Speak(txtSpeechText.Text); ss.SetOutputToDefaultAudioDevice(); MessageBox.Show("完成录音~~~", "提示"); } private void button5_Click(object sender, EventArgs e) { Application.Exit(); } }
标签:blog http io ar for 2014 art div 代码
原文地址:http://www.cnblogs.com/shzalen/p/3958199.html