Text-To-Speech in Windows Phone 8

Introduction

In Windows Phone we have a Text To Speech API that delivers an automated voice of what you really want her to say. In short, the TTS API is synthesized speech that can read the user input or paragraph.

text to speech in windows phone

Requirement

Since this project needs a special privilege capability, first assign ID_CAP_SPEECH_RECOGNIZATION.

compability

Make sure to open WMAppManifest.xml in Designer View. Right-click on WMAppManifest.xml then seelct "Capability" then select (check) ID_CAP_SPEECH_RECOGNITION.

Code

Step 1

First, you need to include the namespace.

  1. using Windows.Phone.Speech.Synthesis; // Included  
Step 2

There is an asynchronous method called SpeechTecAsunc() that does your job. And this method belongs to the SpeechSynthesizer class. So, first we initiate it.
  1. private async void btnTalk_Click(object sender, RoutedEventArgs e)  
  2. {  
  3.    // Start to talk  
  4.    SpeechSynthesizer speech = new SpeechSynthesizer();  
  5.    await speech.SpeakTextAsync(myInputTextBox.Text.ToString());  
  6. }  
Explanation

your app


Every text that you want soken must be placed inside SpeechTextAsync().

Just like that, SpeechTextAsync(“Hello World”) will say Hello World. This is not a complete article but good to start with. In MSDN: Text-to-speech (TTS) for Windows Phone 8'.

Conclusion

It's not the most descriptive one, but I tried to provide a small article on the TTS API. For any issue, try to solve it from the solution file.

 

Up Next
    Ebook Download
    View all
    Learn
    View all