Floating FB sharing byReview Results

Floating FB sharing byReview Results

  • WPF Tutorial

    • # Read in Your Language

    Animation And Multimedia

    Tutorial Home | Animations in WPF | Multimedia in WPF | Speech in WPF

    SpeechSynthesizer and SpeechRecognizer in WPF


    Wpf provides apis to convert text to speech.The namespace for this api is System.Speech. So, to have this functionality include this dll in the reference using the following namespaces in your application. wpf also provides namespace for speech Recognition.

    List namespaces that used for Speech related functionality:

    • System.Speech.Synthesis.TtsEngine
    • System.Speech.Synthesis
    • System.Speech.Audioformat
    • System.Speech.Recognition
    • System.Speech.Recognition.SrgsGrammar

    There are different classes related to speech, these include:

    FilePrompt - Prompt conversion from a file.
    InstalledVoice - An installed Voice object.
    Prompt - Prompt from text.
    PromptBuilder - Empty Prompt object and provides methods for content.
    PromptStyle - Style of prompting with settings for emphasis, rate, and volume.
    SpeechSynthesizer - Speech and DTMF output.
    VoiceInfo - Text-to-speech voice.


    This will convert text to speech.
    This provides four different properties Rate(-10 to 10), State, Voice, and Volume(0 and 100) used to get and set rate, state, voice, and volume.
    SpeechSynthesizer sSynthesizer1= new SpeechSynthesizer(); 
    sSynthesizer1.Volume = 50;  
    sSynthesizer1.Rate = 3;   
    // Synchronous
    SpeakAsync method is used to speak asynchronously with a input prompt or a string.
    // Asynchronous
    SpeechSynthesizer sSynthesizer1= new SpeechSynthesizer();
    Sample 1:
    Creating speech output for the current date and time :
    sSynthesizer1.SpeakAsync("The time is " +DateTime.Now.ToShortTimeString());
    Sample 2:
    SpeechSynthesizer synth1 = new SpeechSynthesizer();
    PromptBuilder prompt1 = new PromptBuilder();

    For SpeechRecognizer create choices,then build a grammar and attach the grammar to SpeechRecognizer.
    SpeechRecognizer recognizer = new SpeechRecognizer();
               Choices choices1 = new Choices();
               choices1.Add("win2wpf one");
               choices1.Add("win2wpf Two");
               Grammar grammar1 = 
                   new Grammar(new GrammarBuilder(choices1));

    << Previous >> | << Home >>