语音播报

第一步 -> 添加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);
            }
posted @ 2019-04-19 11:04  Angel~  阅读(142)  评论(0编辑  收藏  举报