How can I save TTS audio file in UWP?

P2441M 0 Reputation points
2023-08-07T07:12:58.7233333+00:00

I am trying to integrate my Azure Speech service into a UWP application. But I've no idea how to save the Text To Speech result in a wave file, since I can only write files that user selected.

So I've tried to write to the StorageFile directly using SpeechSynthesisResult.AudioData , but the saved audio is invalid to play by doing so. Also, if I use AudioDataStream , it's also hard to save it as a play-able audio.

Any advice would be helpful!

Thank you!

Azure AI Speech
Azure AI Speech
An Azure service that integrates speech processing into apps and services.
2,064 questions
{count} votes

1 answer

Sort by: Most helpful
  1. P2441M 0 Reputation points
    2023-08-09T14:34:57.51+00:00

    Finally, I've solved this question. To my surprise, the solution (best in my situation) is very simple, which is to simply save the audio file to ApplicationData.Current.LocalFolder.Path. This is permitted while saving to other locations isn't.

    But I still can't find a way to save the file to user-selected StorageFile 😅


Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.