此代码在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
请帮助我如何解决这个问题?
感谢
答案 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