using System.Speech.Synthesis;
private static SpeechSynthesizer speech = new SpeechSynthesizer();
/// <summary>
/// read(要朗读的文字,速度,音量)
/// </summary>
/// <param name="read"></param>
/// <param name="rate"></param>
/// <param name="volume"></param>
public static void read(string read, int rate, int volume, bool yibu = true)
{
try
{
speech.Rate = rate;//速度
speech.Volume = volume;//音量,0-100
speech.SpeakAsyncCancelAll();
if (yibu)
{
speech.SpeakAsync(read);//异步播放,但是要等到前面的发音完成后才会播放该发音
}
else
{
speech.Speak(read);
}
}
catch (Exception)
{
}
}
06-11
1189
05-28
06-10
“相关推荐”对你有帮助么?
-
非常没帮助
-
没帮助
-
一般
-
有帮助
-
非常有帮助
提交