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.

How to play Video or Music in Windows phone app using Mediaplayer Launcher

In this article we will learn about the Media Player Launcher that helps to launch the Windows Phone Media Player from our app. It can be used to play the Video or music with uniform Media Player interface.


1. First create a new project having the name Mediaplayer.



2. Before going further add the following Namespace required for the above tasks in the MainPage.xaml.cs.



MediaPlayerLauncher launches the Media Player application and plays the specified media file.
Media files can be stored in isolated storage, the application’s installation directory or any other location not belonging to the phone.


Let us take an example of Video which we need to play on our phone. The code required for this task is given below.



There are different properties in this task that needs to be explained



You can optionally specify that one or more controls should be shown by the Media Player using bitwise OR combinations of the MediaPlaybackControls values:

  • MediaPlaybackControls.All
  • MediaPlaybackControls.None
  • MediaPlaybackControls.Pause
  • MediaPlaybackControls.Stop
  • MediaPlaybackControls.Skip
  • MediaPlaybackControls.FastForward
  • MediaPlaybackControls.Rewind



You can also specify one of these locations using the MediaLocationType enumeration.

  • MediaLocationType.None indicates that the media item is in neither data store and when a Show Method is called with this Option, you might get the FileNotFoundException.
  • MediaLocationType.Install indicates that the Media file is in the Application’s installation directory. In the above example, the test.mp3 is packages with the xap file, so this option is needed.
  • MediaLocationType.Data indicates that the Media file is in the isolated storage or is not present on the phone.


You can also play an audio file in a similar way .Just set the media path to the location of audio file that is either present in your application or is present online.


This might be useful when you want to play an online song on your phone.

Example suppose I want to play an online song the code required for this task is given below.

The code is similar to the video one the only change is in the media path.




1. On the Emulator the application can start the Media Player and play music, but video is not rendered! If possible test on a real device.
2. All audio file formats are not supported on Windows phone. You can check the list of audio formats supported by Windows phone from the link given below.

I hope this post will be helpful to you. You can download the full project source file from the link given below.

Download full source project file