【问题标题】:Text to Speech in Windows Store App using Speech Synthesizer使用语音合成器在 Windows 应用商店应用程序中的文本到语音
【发布时间】:2014-03-07 01:12:45
【问题描述】:

我正在运行这个 Hello World 示例 我的代码是

private async void Button_Click(object sender, RoutedEventArgs e)
        {
            var synth = new Windows.Media.SpeechSynthesis.SpeechSynthesizer();
            Windows.Media.SpeechSynthesis.SpeechSynthesisStream stream = await synth.SynthesizeTextToStreamAsync("Hello World");

            var mediaElement = new MediaElement();
            mediaElement.SetSource(stream,stream.ContentType);
            mediaElement.Play();
        }

当我调试它时,我得到一个错误:

An exception of type 'System.IO.FileNotFoundException' occurred in SunnahForKids.exe but was not handled in user code
Additional information: The specified module could not be found. (Exception from HRESULT: 0x8007007E)

【问题讨论】:

  • 你确定所有被引用的DLL都可用吗?

标签: c# text-to-speech windows-8.1


【解决方案1】:

来自MSDN Reference

要求

支持的最低客户端:Windows 8.1

最低支持服务器:Windows Server 2012 R2

最低支持手机:Windows Phone 8.1 [仅限 Windows 运行时应用]

命名空间:Windows.Media.SpeechSynthesis、Windows::Media::SpeechSynthesis [C++]

【讨论】:

    【解决方案2】:

    如果你使用 Dependency walker 查看 system.speech.dll 的依赖,它会告诉你 “错误:发现具有不同 CPU 类型的模块。” 在 Visual Studio 中将 CPU 设置为 x64 可能会解决您的问题。它对我有用。

    【讨论】:

      【解决方案3】:

      这可能是因为设备上没有安装语音。要解决它,只需添加一个 try catch 块,它只会在安装与您的应用程序的区域和语言相关的语音时“说话”。否则会不说话就跑。

      【讨论】:

        猜你喜欢
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 2012-12-07
        • 1970-01-01
        • 2015-06-02
        • 1970-01-01
        相关资源
        最近更新 更多