Windows Phone 8.1 for Developers – Text to speech

This blog post is part of a series about how Windows Phone 8.1 affects developers. The series is written in collaboration with Microsoft evangelist Peter Bryntesson, check out his blog here.


Using Text to speech (TTS) in your app can make it stand out from the crowd as a cool feature. But it can also come in handy when you want to make your app accessible for more people that has a hard time reading the often small fonts on the screen.

Speak text

In Windows Phone 8.0 it was really easy to get TTS to work. You just added a few lines of code and it was all set:

This code will just take your parameter and speak the text. You had to turn on Speech recognition capability in your app manifest or you would get an Access denied. But overall it’s not that much code.

In Windows Phone 8.1 we have a new API that works like it does in Windows Store apps. Notice we have to enable Microphone capability.

A little bit more code and another namespace than in Windows Phone 8.0. Before we are able to speak our text we must make it into a stream. This stream do we then set as source in our MediaElement (named as player in XAML) before we can play the text. So a few more lines and we now also require a MediaElement to be able to play the text. The nice with this is that now we get a stream and we can do so much fun with a stream. It’s possible to save to disk, share to another player app and use in some awesome audio mixer application.

Get all voices installed

As a result of new namespaces the API for getting the installed voices has also changed. In Windows Phone 8.0 we had:

And in Windows Phone 8.1 we have:

Both return an IReadOnlyList of VoiceInformation, so the result is the same on both platforms.

Getting voice and set a new one

It’s possible to get the current voice we are using and it’s done similar on both platforms. In Windows Phone 8.0:

In Windows Phone 8.1:

To set a new voice, in this example the first female voice. In Windows Phone 8.0:

And in Windows Phone 8.1:



This post described some of the new features of text to speech and how the API changed from Windows Phone 8.0. As we could see the API hadn’t change that much besides how we did play the text aloud. In Windows Phone 8.1 we now require a MediaElement but we benefit from getting a stream we can do whatever we want to.