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); }
public IActionResult PlaySpeech(SpeechAnalyseVM model) => PartialView("_PlaySpeech", model);
public IActionResult TextToSpeech(SpeechAnalyseVM model) => PartialView("_Speech", model);