Save Speech Synthesis Stream as Audio in Windows Phone 8.1

In Windows Phone 8.1 you can generate a SpeechSynthesisStream using text to speech. We earlier tipped you on
Using text to speech in Windows Phone 8 and 8.1
You can use the output SpeechSynthesisStream and save it as a .wav audio file in app’s local storage.


This is not the best method to save the speech stream to audio as it takes a long time to get processed.

Sound off in comments/forums if you find a workaround.

UPDATE: We just found another method to do it and it seems to be quite faster. The sample Transcoding media project uses Windows.Media.Transcoding API to transcode a media file in a Windows Store app.

Using text to speech in Windows Phone 8 and 8.1

You can use the Windows.Phone.Speech.Synthesis API to generate synthesized speech, also known as text-to-speech (TTS), in your Windows Phone 8 app. The following example creates an instance of a speech synthesizer and sets its language with the help of a LINQ query. The LINQ query searches through the VoiceInformation objects that describe each of the installed voices to find one whose language property has a value of “en-US”, which indicates the English language as spoken in US. The argument to the SpeechSynthesizerSetVoice(VoiceInformation) method specifies an index for the voices returned by the LINQ query. Find more details in this MSDN article

Note: To use TTS, you must set the ID_CAP_SPEECH_RECOGNITION capability in the app manifest.

If you are developing a Windows Phone 8.1 XAML app then use the following code instead.

Add a media element in your page and set its visibility to Collapsed if you don’t wish to display it.

Note: Add Microphone capability using Package.appmanifest.