I have tried to make a simple console program which uses SpeechSynthesizer
from System.Speech.Synthesis
to convert text to speech but it doesn't work.
I am using 64-bit Windows 7 and Visual Studio 2010 (with .NET Framework 4.0 I think?)
The program:
using System.Speech.Synthesis;
// *skip*
SpeechSynthesizer speech = new SpeechSynthesizer();
speech.SetOutputToDefaultAudioDevice();
speech.Speak("Hello world");
InvalidOperationException
occurs at line speech.Speak(...)
with message No voice installed on the system or none available with the current security setting.
speech.GetInstalledVoices()
shows that there is Microsoft Anna installed and the Enabled
of it is also set to true
.
I have tried replacing System.Speech.Synthesis
with Microsoft.Speech.Synthesis
(dll found at C:\Program Files (x86)\Microsoft Speech Platform SDK\Assembly\Microsoft.Speech.dll) but the same thing happens.
Navigating to Control Panel > Speech > Text To Speech and clicking "Preview Voice" also fails with a message This voice cannot be played. Please try selecting another voice or selecting a different audio output device. Microsoft Anna - English (United States) is found there as the only option.
(Windows' Speech Recognition works though, if that has any help.)
Some solution suggested navigation to Registry Editor, HKEY_LOCAL_MACHINE > SOFTWARE > Microsoft > Speech > Voices > Tokens and fixing a broken Language-key. Under token is MS-Anna-1033-20-DSK > Attributes and the Language-key is 409 as it should be.
Another solution suggested changing Active solution platform from Visual Studio's Configuration Manager but I have tested the program with Any CPU, x86 and x64 and none works.
What's wrong with my text to speech? :(
EDIT:
Installed Visual Studio 2012 just in case it was a problem with .NET Framework 4.0 as VS2012 supports 4.5, but it didn't work either.
I suppose the problem is within my Windows 7 as even the built in Text-to-Speech thing doesn't work.