Windows Phone 8.1 Text to Speech, Speech to Text and Cortana
Windows Phone 8.1 will be hitting phones soon now. Yeah, I know all of YOU are running the Windows Phone 8.1 Dev Preview, but for the general user, most should be getting in the coming weeks and months (insert standard disclaimer that your mileage may vary, dates are estimates and under external control, etc., etc.)
One of the most existing features of Windows Phone 8.1 is Cortana. While Cortana is pretty awesome out of the box, you can take the different Text to Speech and Speech to Text and run with it in your apps.
Vikram Pendse shows us how...
This article shows how to build Text to Speech Applications in Windows Phone 8.1. It also gives an overview of Cortana, the personal digital assistant.
Microsoft is making efforts to improve the User experience and Developer experience on both Phone and Desktop Platform. Recently in the Build 2014 conference Microsoft announced a new version of Windows Phone OS as Windows Phone 8.1. With this announcement, they also made Windows Phone 8.1 APIs available for Developers to build next generation Windows Phone 8.1 Apps. In this article, we will talk about implementing Text To Speech Capability in Apps targeting the new Windows Phone 8.1 Platform and also we will talk about some changes in the same.
Windows Phone 8.1 Development Tools
Like Windows Phone 8.0, you will not find a standalone SDK for Windows Phone 8.1 since now Microsoft has made it available as a part of Visual Studio Update. So Visual Studio Update 2 RC has built-in tooling and set of APIs along with Project Templates, to build Windows Phone 8.1 Apps. For more information and download check: https://dev.windowsphone.com/en-us/downloadsdk
Blank App (Windows Phone) Vs Blank App (Windows Phone Silverlight)
Text To Speech / Speech To Text and “Cortana” in Windows Phone 8.1
Now coming back to APIs, In Windows Phone 8.1, the primary API for Text To Speech and Speech To Text is Windows.Media.SpeechSynthesis . In Windows Phone 8.0 it was Windows.Phone.Speech.Synthesis . In Windows Phone 8.1, for Text To Speech we need SpeechSysnthesisStream to a MediaElement. SpeechSysnthesisStream helps to generate asynchronous voice output from Text. So MediaElement plays a vital role for reading text. Now we will build a simple Text To Speech App to have an idea how it works on the new platform. We will also discuss in parallel about how we as a developer need to do some code changes if we have existing Text To Speech App in Windows Phone 8.0, before migrating them to Windows Phone 8.1
Quickly Build Text To Speech App using Windows Phone 8.1 using Blank App (Windows Phone)
Firstly choose a Blank App (Windows Phone) from File > New Project Menu as shown below
Text To Speech
Now we will see an implementation of Text To Speech. ...
Text To Speech using SSML
If you are not much familiar with SSML (Speech Synthesis Markup Language), then please visit http://www.w3.org/TR/speech-synthesis/ for a detailed documentation.
We will put our Text in Non-English Text (say in Japanese) to test out SSML as shown below.
Speech To Text
Here comes the trickiest part; recognizing your voice and translating it to Text. We are already aware of the richness of Voice Commands in Windows Phone 8.0 world. But here since we are looking at primary changes in API and new additions, we are not talking about Voice Commands. We will discuss that in depth in another upcoming article.
Earlier in Windows Phone 8.0, we would get the GSE (Global Speech Experience) when tapping the “Windows/Home” button for some time. We used it to give certain Voice Commands and GSE would translate those and do the needful, like calling a contact on our phone or running an App etc.
With introduction to Cortana, things have changed and now GSE is now available out of the box in Cortana. So pressing the “Windows/Home” in Windows Phone 8.1 world, will show you the following:
Cortana – Your own Personal Digital Assistant & Making It Available In your Region (Hack)
As I briefly mentioned earlier, during Build 2014, Microsoft announced the availability of Cortana (Personal Digital Assistant) on devices running Windows Phone 8.1 OS. “Cortana” is in a Beta stage and currently only available in USA Region on Devices. So Non USA Region locals might not find Cortana by tapping on the Search button. In that case, they will be automatically redirected to Bing Search. To read more on Cortana visit the Windows Phone Blog article which gives macro level overview of Cortana
So the next question that comes up is “Is it only on devices? What about Non US regions?” – Well you can always change your region to US and make Cortana available on your devices. This will be completely on your own risk. It is not advisable to do so, this might have impact on functioning of your device. So do the region change at your own risk. We certainly do not recommend doing it, but it has worked for some of us.
If you are a Windows Phone Developer, then Cortana is always available for you irrespective of your country. Once you start Emulator, Tap on “Search” button of your emulator and then all you need is sign-in with your Live ID. Once you configure this with Live ID, your Live ID Contacts and Data will automatically get synced on the Emulator. You can also save this to Checkpoint to avoid Sign-in every time (Checkpoint is another new feature where your emulator state is maintained with generic data like Contacts and Settings etc.)
Windows Phone 8.1 brings out a of opportunities for Developers to build next generation apps for a hugely growing number of Windows Phone consumer across the world. Text To Speech and Speech To Text always comes handy and helpful for all consumers across the world. Such features not only save time, but also bring up a personalized experience in local languages. In this article, we saw how you can build such apps within a short span of time. We also visited the changes for Silverlight based template for Windows Phone 8.0. Finally we had a decent overview of the new personal digital assistant as Cortana. So get the tools and start building Voice based apps today.