zoukankan      html  css  js  c++  java
  • .net 使用语音播放文字

    在 .net 中通过语音来播放文字的方法非常简单。

    步骤1:

    在工程中引用 System.Speech.dll。

    步骤2:

    代码如下

     1 SpeechSynthesizer voice = new SpeechSynthesizer();   //创建语音实例
     2 voice.Rate = -1; //设置语速,[-10,10]
     3 voice.Volume = 100; //设置音量,[0,100]
     4 voice.Speak("测试");  //播放指定的字符串,这是异步朗读
     5 
     6  //下面的代码为一些SpeechSynthesizer的属性,看实际情况是否需要使用
     7 //voice.SpeakAsyncCancelAll();  //取消朗读
     8 //voice.Speak("Hellow Word");  //同步朗读
     9 //voice.Pause();  //暂停朗读
    10 //voice.Resume(); //继续朗读
    11 
    12 voice.Dispose();  //释放所有语音资源
  • 相关阅读:
    每日总结
    每日总结
    每日总结
    每日总结
    每日总结
    每日总结
    每日总结
    每日总结
    每日总结
    jenkins无需登录,查看测试任务结果,allure报告
  • 原文地址:https://www.cnblogs.com/xiefang2008/p/9467619.html
Copyright © 2011-2022 走看看