TTS Introduction For Windows Phone 8


Windows Phone supports voice input as well as voice output. In this article we will learn how to convert text into speech in Windows Phone 8. This feature is also known as Text-To-Speech (TTS) . You can use it in your application for pronouncing the text. Let's see how to use this feature in our app.

Speech Synthesis Namespace

The namespace contains the text to speech functionality.  It consists of the following classes:

  • InstalledVoices

    Provide access to the synthesized voices that are available for use.
  • SpeechBookmarkedReachedEventArgs

    Provides arguments of the BookmarkedReached event.
  • SpeechStartedEventArgs

    Arguments for the speech started event.
  • SpeechSynthesizer

    Main class that is used for working with a synthesized TTS voice.
  • VoiceInformation

    Defines Information about TTS.

Speak Text Async Method

  • This is the main method that we need to use in our app for converting text into voice.
  • Signature

    await SpeakTextAsync(String)
  • Arguement

    String: A plain text that we want to convert.

Implementing TTS

The following code snippet implements the text to speech feature:











    FontFamily="{StaticResource PhoneFontFamilyNormal}"

    FontSize="{StaticResource PhoneFontSizeNormal}"

    Foreground="{StaticResource PhoneForegroundBrush}"

    SupportedOrientations="Portrait" Orientation="Portrait"



    <!--LayoutRoot is the root grid where all page content is placed-->

    <Grid x:Name="LayoutRoot" Background="Transparent">


            <RowDefinition Height="Auto"/>

            <RowDefinition Height="*"/>



        <!--TitlePanel contains the name of the application and page title-->

        <StackPanel x:Name="TitlePanel" Grid.Row="0" Margin="12,17,0,28">

            <TextBlock Text="Demo" Style="{StaticResource PhoneTextNormalStyle}" Margin="12,0"/>

            <TextBlock Text="TTS Demo" Margin="9,-7,0,0" FontSize="40"/>



        <!--ContentPanel - place additional content here-->

        <Grid x:Name="ContentPanel" Grid.Row="1" Margin="12,0,12,0">

            <Button Name="startBtn" Click="startBtn_Click" Content="Start" HorizontalAlignment="Left" Margin="10,0,0,10" Width="446" Height="72" VerticalAlignment="Bottom"/>

            <TextBox Name="txtArea" Text="Text To Speak" HorizontalAlignment="Left" Height="567" Margin="10,0,0,0" TextWrapping="Wrap" VerticalAlignment="Top" Width="446"  InputScope="Text" />





C# Code Behind

using Microsoft.Phone.Controls;

using System;

using System.Collections.Generic;

using System.Linq;

using System.Net;

using System.Windows;

using System.Windows.Controls;

using Windows.Phone.Speech.Synthesis;


namespace Demo


    public partial class MainPage : PhoneApplicationPage


        // Constructor

        public MainPage()





        private async void startBtn_Click(object sender, RoutedEventArgs e)


            SpeechSynthesizer s = new SpeechSynthesizer();  // New TTS Instance

            await s.SpeakTextAsync(txtArea.Text); // Start TTS







TTS is a very useful feature that can be used creatively to create some wonderful apps. As a last note don't forget to set a ID_CAP_SPEECH_RECOGNITION Capablity in your app manifest.