Add Speech to an application Fast! (Works on Windows Server 8)

Keywords: C#,  Text to Speech , TTS, Microsoft. Free.

You can adjust voice as well, but this is plain jane and simple.

Code:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Speech;
using System.Speech.Synthesis;
//using Microsoft.Speech.Synthesis; –error for some reason even when using another thread.
namespace KinectDemo
{
      public class SpeechWrapper
     {
         private SpeechSynthesizer MySynth { get; set; }
         public Action Say { get; set; }
         public SpeechWrapper()
        {
           MySynth = new SpeechSynthesizer();
          MySynth.Rate = -4;
          MySynth.SelectVoiceByHints(VoiceGender.Male, VoiceAge.Child);
          MySynth.Volume = 100;
          Say = ((input) =>
         {
               MySynth.Speak(input);
         });
       }
   }
}

Implementation:

public property:
public SpeechWrapper VoiceOfTheOne { get; set; }

Set Value: VoiceOfTheOne = new SpeechWrapper();

Say Something is easy now:VoiceOfTheOne.Say(“Welcome to Augmented Reality By Daniel Turnell and Mark Rowe”);

Categories: Uncategorized

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: