Ejemplo n.º 1
0
        public async Task <IActionResult> GetPreview(Guid sourceId, string text, Language language, Speaker speaker, Emotion emotion, decimal speed, int offset = 0)
        {
            var headers = await _sourceService.GetHeaders(sourceId);

            var content = await _sourceService.GetContent(sourceId, 1, offset);

            var finalText = _textConverter.GenerateResultingText(headers, content.Items.FirstOrDefault(), text);

            var voiceFile = await _voiceService.GenerateAudio(finalText, language, speaker, emotion, speed);

            return(File(voiceFile.Value, "audio/mpeg", voiceFile.Key));
        }