Speech Synthesis fails to SetVoice(). All are listed as enabled, until it's tried, then fails with the non-default two listed as 'disabled'.
NOTE: This works on a WPF or Console app, but fails as an ASP.NET app. ALSO: Speech is created on an alternate thread (Task.Run(()=>StartSpeech()) since it permanently locks the main thread for ASP.NET applications (see No response to a HTTP Get request in WebAPI in .NET 4.5 while using SpeechSynthesis for converting text to speech for details). However, the SelectVoice() fails on both the alternate thread as well as the main.
Ideas?
private SpeechSynthesizer speech; //System.Speech.Synthesis
var voices = speech.GetInstalledVoices();
//[0]: "Microsoft David Desktop" ["Enabled"]
//[1]: "IVONA 2 Emma" ["Enabled"]
//[2]: "Microsoft Zira Desktop" ["Enabled"]
try
{
speech.SelectVoice( "Microsoft Zira Desktop" );
}
catch (Exception e)
{
var p = e; //fails (System.ArgumentException: Cannot set voice. No matching voice is installed or the voice was disabled)
}
voices = speech.GetInstalledVoices();
//[0]: "Microsoft David Desktop" ["Disabled"]
//[1]: "IVONA 2 Emma" ["Enabled"]
//[2]: "Microsoft Zira Desktop" ["Disabled"]
speech.SpeakAsync( text );