使用语音合成器在Windows应用商店应用中使用文本转换语音

use*_*229 6 c# text-to-speech windows-8.1

我正在运行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();
        }
Run Code Online (Sandbox Code Playgroud)

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

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)
Run Code Online (Sandbox Code Playgroud)

小智 1

来自MSDN 参考

要求

支持的最低客户端:Windows 8.1

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

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

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