gpt4 book ai didi

c# - 初始化 SpeechSynthesizer 时出现 UnauthorizedAccessException

转载 作者:行者123 更新时间:2023-11-30 15:32:16 27 4
gpt4 key购买 nike

我正在使用 Microsoft 的 SpeechSynthesizer 为我的 Windows Phone 应用创建音频输出。我用这个代码

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();

最佳答案

确保您已将功能 ID_CAP_SPEECH_RECOGNITION 添加到应用程序 list (WMAppManifest.xml)。

关于c# - 初始化 SpeechSynthesizer 时出现 UnauthorizedAccessException,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/19344253/

27 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com