语音播报
第一步 -> 添加COM类库 引用 ->Microsoft Speech Object Library
第二步 -> 引用 using SpeechLib;
第三步骤 执行代码 var str = textBox1.Text;
SpeechVoiceSpeakFlags flag = SpeechVoiceSpeakFlags.SVSFlagsAsync;
SpVoice voice = new SpVoice();
int num=3;
for (int i = 0; i < num; i++)
{
string voice_txt = "请"+str+"到就诊部就诊";
voice.Voice = voice.GetVoices(string.Empty, string.Empty).Item(0);
voice.Speak(voice_txt, flag);
}
扫码关注我们
微信号:SRE实战
拒绝背锅 运筹帷幄
第二步 -> 引用 using SpeechLib;
第三步骤 执行代码 var str = textBox1.Text;
SpeechVoiceSpeakFlags flag = SpeechVoiceSpeakFlags.SVSFlagsAsync;
SpVoice voice = new SpVoice();
int num=3;
for (int i = 0; i < num; i++)
{
string voice_txt = "请"+str+"到就诊部就诊";
voice.Voice = voice.GetVoices(string.Empty, string.Empty).Item(0);
voice.Speak(voice_txt, flag);
}

更多精彩