Reputation: 111
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
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':
Upvotes: 2
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