Codeviews
Codeviews

Reputation: 111

Speech in using System.Speech.Synthesis is not recognized.

I'm trying to use the Speech Synthesis function for an universal app. I looked at the Microsoft documentation and its says that the name space is System.Speech.Synthesis. However, when i type System.Speech.Synthesis. It says that speech is not recognized. What am i doing wrong?

Upvotes: 1

Views: 2371

Answers (2)

Rotem Varon
Rotem Varon

Reputation: 1647

Here is a working example:

using System.Speech.Synthesis;

static void Main(string[] args)
{
   ...
   // Speech helper
   SpeechSynthesizer reader = new SpeechSynthesizer();
   const string msg = "Hello";
   Console.WriteLine(msg);
   reader.SpeakAsync(msg);
}

Also, make sure you referencing 'System.Speech':

enter image description here

Upvotes: 2

Bill Blankenship
Bill Blankenship

Reputation: 3356

You need to add the reference to your project. References, right click, add reference after finding it.

If that still doesn't work you need to right click in your .cs file on your variable and resolve to System.Speech.

Upvotes: 0

Related Questions