我正在使用Microsofts SpeechSynthesizer为我的Windows应用程序创建音频输出。我使用这个代码
private async void TextToSpeech_Tap(object sender, System.Windows.Input.GestureEventArgs e)
{
SpeechSynthesizer synth = new SpeechSynthesizer();
await synth.SpeakTextAsync("You have a meeting with Peter in 15 minutes.");
}我明白这一例外:
{System.UnauthorizedAccessException: Access is denied.
at Windows.Phone.Speech.Synthesis.SpeechSynthesizer..ctor()
at NerdQuiz.Question.<TextToSpeech_Tap>d__1.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.CompilerServices.AsyncMethodBuilderCore.<ThrowAsync>b__0(Object state)}我发现错误发生在
new SpeechSynthesizer();发布于 2013-10-13 12:40:13
确保将功能ID_CAP_SPEECH_RECOGNITION添加到应用程序清单(WMAppManifest.xml)中。
发布于 2015-05-30 01:41:20
在Windows (UWP应用程序)中,使用SpeechSynthetizer需要麦克风功能。(我不知道为什么,但一旦启用,我就不例外了)
https://stackoverflow.com/questions/19344253
复制相似问题