I'm trying to generate file with text-to-speech approach.
public AudioResponse GenerateAudio()
{
_speechConfig.SpeechSynthesisVoiceName = $"{request.Language}-{request.Voice}";
using SpeechSynthesizer synthesizer = new(_speechConfig);
SpeechSynthesisResult result = await synthesizer.SpeakTextAsync("Test");
File.WriteAllBytes(@"D:\front-doors-opening.mp3", result.AudioData);
return new AudioResponse { Audio = result.AudioData };
}
When Generate Audio is executing, file stores and SpeakTextAsync plays my text. Is there any way to configure SpeechSynthesize to generate AudioData without producing it?
Packages:
Microsoft.CognitiveServices.Speech - Version="1.23.0"
.NET 6