public async Task <SpeechAnalyseVM> AnalyseSpeechAsync(string content, string baseUrl)
        {
            var speechModel = new SpeechAnalyseVM()
            {
                Filename = $"{DateTime.Now.ToString("yyyyMMddHHmmss")}_{Guid.NewGuid()}"
            };

            try
            {
                var webPath = _hostingEnv.WebRootPath;
                var path    = Path.Combine("", webPath + @"\sound\" + speechModel.Filename + ".wav");

                await TranslateText(content, path);

                speechModel.Url     = $"{baseUrl}sound/{speechModel.Filename}.wav";
                speechModel.Content = content;
                speechModel.Message = "Success";
            }
            catch (Exception)
            {
                speechModel.Message = $"Error: An error occured while analyzing the text.";
            }
            return(speechModel);
        }
Beispiel #2
0
 public IActionResult PlaySpeech(SpeechAnalyseVM model)
 => PartialView("_PlaySpeech", model);
Beispiel #3
0
 public IActionResult TextToSpeech(SpeechAnalyseVM model)
 => PartialView("_Speech", model);