1、准备前工作,查看系统语音
2、C# 里引用speech
3、实现输入文字,语音播报出来,代码
private void btnplay_Click(object sender, EventArgs e)
{
if (string.IsNullOrWhiteSpace(textBox1.Text))
{
MessageBox.Show("内容不可为空");
return;
}
SpeechSynthesizer speech = new SpeechSynthesizer();
speech.Rate = this.Speed; //语速
speech.Volume = this.Volume; //声音
speech.SelectVoice("Microsoft Huihui Desktop");//设置中文
speech.Speak(this.textBox1.Text);
}