private async void SendTTSData(TTSClient tts, string[] sentences)
 {
     foreach (var sentence in sentences)
     {
         await tts.DoTTS(config, sentence);
     }
 }
Beispiel #2
0
 private async void SendTTSData(TTSClient tts, string[] sentences)
 {
     foreach (var sentence in sentences)
     {
         await tts.DoTTS(config.UnifiedKey, config.UnifiedRegion, sentence, config.Locale);
     }
 }
        public override void OnOpen()
        {
            Console.WriteLine("WS Opened");
            var ttsText = context.Request.Query["text"][0];

            var tts = new TTSClient(OnTTSData, () => { Console.WriteLine("TTS End"); });

            var sentences = ttsText.Split(new char[] { ';', '。', '?', '?' });

            foreach (var sentence in sentences)
            {
                tts.DoTTS(config, sentence).Wait();
            }
            webSocket.CloseAsync(WebSocketCloseStatus.Empty, "finished", CancellationToken.None).Wait();
        }
Beispiel #4
0
        public override void OnOpen()
        {
            Console.WriteLine("WS Opened");
            var ttsText = context.Request.Query["text"][0];

            var tts = new TTSClient(OnTTSData, () => { Console.WriteLine("TTS End"); });

            var sentences = ttsText.Split(new char[] { ';', '。', '?', '?' });

            foreach (var sentence in sentences)
            {
                tts.DoTTS(config.UnifiedKey, config.UnifiedRegion, sentence, config.Locale).Wait();
            }
            try
            {
                webSocket.CloseAsync(WebSocketCloseStatus.NormalClosure, "finished", CancellationToken.None).Wait();
            }
            catch (Exception)
            { }
        }