win10系统测试通过

 

 第一种方法,最简单

  private static  dynamic _comTts;
        Type type = Type.GetTypeFromProgID("SAPI.SpVoice");
        private void Read(string text)
        {
            Task.Factory.StartNew(() =>
            {
                try
                {
                    _comTts = Activator.CreateInstance(type);
                    _comTts.Speak(text);
                }
                catch{}
            });

        }

  第二种方法

要引用 using System.Speech.Synthesis;

            SpeechSynthesizer synth = new SpeechSynthesizer();
            synth.SetOutputToDefaultAudioDevice();
            synth.Speak("欢迎使用");

 

相关文章:

  • 2021-09-28
  • 2021-07-25
  • 2021-08-31
猜你喜欢
  • 2021-11-08
  • 2022-12-23
  • 2021-11-04
  • 2021-08-08
  • 2022-12-23
  • 2021-06-25
  • 2021-08-03
相关资源
相似解决方案