在线时间:8:00-16:00
迪恩网络APP
随时随地掌握行业动态
扫描二维码
关注迪恩网络微信公众号
using System; using System.Speech.Synthesis; namespace testvoice { class Program { static void Main(string[] args) { SpeechSynthesizer synth = new SpeechSynthesizer(); //获取本机上所安装的所有的Voice的名称 string voicestring = ""; foreach (InstalledVoice iv in synth.GetInstalledVoices()) { voicestring += iv.VoiceInfo.Name + ","; } //voicestring的值是Microsoft Lili,Microsoft Anna synth.Volume = 100; synth.Rate = -5; //根据Voice的name属性确定要使用的Voice //synth.SelectVoice("Microsoft Anna");//美式发音,但只能读英文 synth.SelectVoice("Microsoft Lili");//能读中英文 //根据文字内容合成语音 synth.Speak("你好"); Console.Read(); } } }
|
请发表评论