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);
            }
        }
    }
  • 相关阅读:
    组件映射
    联合主键关联
    一对一单向双向主键关联
    7函数
    forEach与map
    3运算符与表达式
    作用域声明提升
    php程序设计 1,2章节
    angularJs(3)过滤器
    angularJs(1)指令篇
  • 原文地址:https://www.cnblogs.com/ChineseMoonGod/p/5517380.html
Copyright © 2011-2022 走看看