O'Reilly logo

Windows Application Development Cookbook by Marcin Jamro

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Synthesizing speech

Is it possible for an application to speak to a user? Of course! The speech synthesis mechanism, also referred as Text To Speech (TTS), is available for developers, and you will learn how to use it in this recipe.

As an example, you will create an application that says Hello, dear reader! How are you? when a user is navigated to the main page.

Getting ready

To step through this recipe, you only need the automatically generated project.

How to do it...

To synthesize the text Hello, dear reader! How are you? after navigating to the page, override the OnNavigatedTo method in the MainPage.xaml.cs file, as follows:

    protected async override void OnNavigatedTo(NavigationEventArgs e) 
    { 
        SpeechSynthesizer synthesizer = new SpeechSynthesizer(); ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required