WP-报读TTS

来源:互联网 发布:网络文件管理系统 编辑:程序博客网 时间:2024/06/16 15:14
 #region TTS文本朗读        public async static void SpeechByStr(string str)        {            string lag = PublicObject.IsEnglish ? "en-US" : "zh-CN";            SpeechSynthesizer _synth = new SpeechSynthesizer();            try            {                var voices = (from voice in InstalledVoices.All                              where voice.Language == lag                              select voice).OrderByDescending(v => v.Gender);                _synth.SetVoice(voices.ElementAt(0));                await _synth.SpeakTextAsync(str);            }            catch { }        }        #endregion


直接调用就行了(女声)性别自己看代码修改就行了


详细留意翻 http://www.it165.net/pro/html/201307/6437.html

0 0
原创粉丝点击