示例#1
0
 static Program()
 {
     _ttsClient = new Tts("4zGAhiQANs9tjMv4p1BCGmdh", "fbb284bd4c52f984bf63c78f0d661600");
 }
示例#2
0
文件: SpeechDemo.cs 项目: cddldg/DG
 public SpeechDemo()
 {
     _asrClient = new Asr(Key, Secret);
     _ttsClient = new Tts(Key, Secret);
 }
示例#3
0
 public Main()
 {
     InitializeComponent();
     _asrClient = new Asr(API_KEY, SECRET_KEY);
     _ttsClient = new Tts(API_KEY, SECRET_KEY);
 }
示例#4
0
 public SpeechDemo()
 {
     _asrClient = new Asr("7bZfvZvN3WpShcHwoT1hTpz1", "5b6a4e7316289ac109d6558848678991");
     _ttsClient = new Tts("7bZfvZvN3WpShcHwoT1hTpz1", "5b6a4e7316289ac109d6558848678991");
 }
示例#5
0
 public AddUserGroup(Face clientAll, Tts client2All)
 {
     InitializeComponent();
     client  = clientAll;
     client2 = client2All;
 }
 public SpeechRecognitionController()
 {
     _asrClient = new Asr("FDMQIcuMyqMUuBPZVi9WHhYZ", "f5GmDPs1t34unCekiP5L0yEGQv7UG6qk");
     _ttsClient = new Tts("FDMQIcuMyqMUuBPZVi9WHhYZ", "f5GmDPs1t34unCekiP5L0yEGQv7UG6qk");
 }
 public SpeechDemo()
 {
     //_asrClient = new Asr("Api Key", "Secret Key");
     _ttsClient = new Tts("SjasQWCPjMIl8oidHKCCn6mh", "cd0945f3f5d1cdeea7504c5885764131");
 }
示例#8
0
 public SpeechDemo()
 {
     _asrClient = new Asr(apikey, secretkey);
     _ttsClient = new Tts(apikey, secretkey);
 }
示例#9
0
 public SpeechAPI()
 {
     _asrClient = new Asr(Config.clientId, Config.clientSecret);
     _ttsClient = new Tts(Config.clientId, Config.clientSecret);
 }
示例#10
0
 public Speech()
 {
     _asrClient = new Asr("asMPqxyOZG8Szn0HTNlIROOu", "ac8f300c10b49d226ba8dcaad3687b8a");
     _ttsClient = new Tts("Api Key", "Secret Key");
 }
示例#11
0
        /// <summary>
        /// 语音合成1024字节最大
        /// </summary>
        /// <param name="text"></param>
        /// <returns></returns>
        public static string Tts(string text)
        {
            try
            {
                if (!string.IsNullOrEmpty(text))
                {
                    string url = "";
                    if (text.Contains('{'))
                    {
                        //int uu = text.IndexOf("url\":\"");
                        //if (uu > 0)
                        //{
                        //    text = text.Substring(uu + 6, text.Length - uu - 6);
                        //    int yy = text.IndexOf('\"');
                        //    url = text.Substring(0, yy);
                        //    return url;//还有不是MP3的url
                        //}
                        //else
                        //{
                        //    return null;
                        //}
                        return(null);//json字符串的不生成url
                    }
                    else
                    {
                        if (tts == null)
                        {
                            string APP_ID     = "14884741";
                            string API_KEY    = "UNBsgAYhfLciqDsWRApMmSTn";
                            string SECRET_KEY = "bLpvCoLguv8Xg04c6E8W8LVgwluC4GC4";
                            tts         = new Tts(API_KEY, SECRET_KEY);
                            tts.Timeout = 60000;  // 修改超时时间
                        }

                        // 可选参数
                        var option = new Dictionary <string, object>()
                        {
                            { "spd", 6 }, // 语速
                            { "vol", 5 }, // 音量
                            { "per", 4 } // 发音人,发音人选择, 0为普通女声,1为普通男生,2为普通男生,3为情感合成-度逍遥,4为情感合成-度丫丫,默认为普通女声
                        };
                        var    result = tts.Synthesis(text, option);
                        string path   = "";
                        if (result.ErrorCode == 0)  // 或 result.Success
                        {
                            string filename = DateTime.Now.ToString("HHmmss-fff") + ".mp3";
                            path = $"{ mp3Path}{ DateTime.Now.Date.ToString("yyyyMMdd")}\\{filename}";//C:\IIS\MP3\20181216\150225-266.mp3
                            if (!Directory.Exists($"{ mp3Path}{ DateTime.Now.Date.ToString("yyyyMMdd")}"))
                            {
                                Directory.CreateDirectory($"{ mp3Path}{ DateTime.Now.Date.ToString("yyyyMMdd")}");
                            }
                            File.WriteAllBytes(path, result.Data);

                            url = $"{mp3Url}{ DateTime.Now.Date.ToString("yyyyMMdd")}/{filename}";//http://47.107.66.121:8044/20181216/150225-266.mp3
                        }
                        return(url);
                    }
                }
                else
                {
                    return(null);
                }
            }
            catch (Exception)
            {
                throw;
            }
        }
示例#12
0
 public SpeechDemo()
 {
     _asrClient = new Asr("Api Key", "Secret Key");
     _ttsClient = new Tts("Api Key", "Secret Key");
 }
示例#13
0
 public Speech()
 {
     _asrClient = new Asr("GXrdsGDVgDKOutcdlo3jNnmq", "29AfMqIO4CN5rOl0cu3lRo2BuAEvqsIG");
     _ttsClient = new Tts("GXrdsGDVgDKOutcdlo3jNnmq", "29AfMqIO4CN5rOl0cu3lRo2BuAEvqsIG");
 }
示例#14
0
 public MP3SpeechGenerator(SpeechAppData appData, TTSParam ttsParam = default(TTSParam))
 {
     _tts = new Tts(appData.apiKey, appData.secretKey);
 }