zoukankan      html  css  js  c++  java
  • 可直接拿来用的文本转语音的代码

    using DotNetSpeech;
    using System;
    using System.Collections.Generic;
    using System.Linq;
    using System.Text;
    
    namespace YLSoft.Pola.Utils.Common
    {
        public class VoiceHelper
        {
            private int _volume=100;
            /// <summary>
            /// 音量(从0到100的整数)
            /// </summary>
            public int Volume
            {
                get
                {
                    if (_volume < 0)
                        _volume= 0;
                    else if(_volume>100)
                    {
                        _volume = 100;
                    }
                    return _volume;
                }
                set { _volume = value; }
            }
    
            private int _rate=0;
    
            public int Rate
            {
                get { return _rate; }
                set { _rate = value; }
            }
            public  void ProduceVoice(string strContent)
            {
                DotNetSpeech.SpeechVoiceSpeakFlags SSF = DotNetSpeech.SpeechVoiceSpeakFlags.SVSFlagsAsync;
                DotNetSpeech.SpVoice vo = new SpVoiceClass();
                vo.Volume = Volume;
                vo.Rate = Rate;
                vo.Speak(strContent, SSF);
            }
        }
    }
  • 相关阅读:
    gitlab 安装升级
    fping 命令
    sed 命令
    rm 命令
    sort 命令
    第十六单元
    第十五单元
    第十三单元
    第十二单元
    第十一单元
  • 原文地址:https://www.cnblogs.com/ChineseMoonGod/p/5517380.html
Copyright © 2011-2022 走看看