文本到语音通用应用程序不起作用

时间:2015-11-15 18:15:38

标签: windows-phone-8.1 text-to-speech win-universal-app speech winrt-async

此代码在windows universal app 10中不起作用

        var mediaPronunciation = new MediaElement();

        using (var speech = new SpeechSynthesizer())
        {
            speech.Voice = SpeechSynthesizer.AllVoices
                .First(i => i.Gender == VoiceGender.Male);

            var voiceStream = await speech.SynthesizeTextToStreamAsync("fast");

            mediaPronunciation.SetSource(voiceStream, voiceStream.ContentType);
            mediaPronunciation.Play();
        }

我有这个错误

  

{“找不到指定的模块。(HRESULT异常:0x8007007E)”:null}

我找到了这个主题,他有同样的问题 How do you make Speech to Text work in Windows (Phone) 8.1 Universal App

请帮助我如何解决这个问题?

This image show Marker is null

感谢

2 个答案:

答案 0 :(得分:1)

var speech= new SpeechSynthesizer();
speech.Voice = SpeechSynthesizer.AllVoices
            .First(i => i.Gender == VoiceGender.Male);
SpeechSynthesisStream sss =await speech.SynthesizeTextToStreamAsync("fast");
mediaPronunciation.SetSource(sss, sss.ContentType);
mediaPronunciation.Play();

试试这个......

答案 1 :(得分:0)

最后我解决了这个问题, 每个人都必须为播放器下载此文件: Download and install media pack for N SKU of Windows 10 introduced  ,现在你可以享受使用文字转语音

非常感谢弗雷德先生 - > My question in MSDN