3. 文字语音 text-to-speech (TTS) 对应 ID_CAP_SPEECH_RECOGNITION capability in the app manifest
最后 TTS 大家很容易理解的 就是把文字转换成声音念出来很简单
private async void ButtonSimpleTTS_Click(object sender, RoutedEventArgs e)
{
SpeechSynthesizer synth = new SpeechSynthesizer();
await synth.SpeakTextAsync("You have a meeting with Peter in 15 minutes.");
}
{
SpeechSynthesizer synth = new SpeechSynthesizer();
await synth.SpeakTextAsync("You have a meeting with Peter in 15 minutes.");
}
当然也同样支持语言的选择
// Declare the SpeechSynthesizer object at the class level.
SpeechSynthesizer synth;
// Handle the button click event.
private async void SpeakFrench_Click_1(object sender, RoutedEventArgs e)
{
// Initialize the SpeechSynthesizer object.
synth = new SpeechSynthesizer();
// Query for a voice that speaks French.
IEnumerable<VoiceInformation> frenchVoices = from voice in InstalledVoices.All
where voice.Language == "fr-FR"
select voice;
// Set the voice as identified by the query.
synth.SetVoice(frenchVoices.ElementAt(0));
// Count in French.
await synth.SpeakTextAsync("un, deux, trois, quatre");
}
SpeechSynthesizer synth;
// Handle the button click event.
private async void SpeakFrench_Click_1(object sender, RoutedEventArgs e)
{
// Initialize the SpeechSynthesizer object.
synth = new SpeechSynthesizer();
// Query for a voice that speaks French.
IEnumerable<VoiceInformation> frenchVoices = from voice in InstalledVoices.All
where voice.Language == "fr-FR"
select voice;
// Set the voice as identified by the query.
synth.SetVoice(frenchVoices.ElementAt(0));
// Count in French.
await synth.SpeakTextAsync("un, deux, trois, quatre");
}
这里我就是直接粘贴的MSDN代码 真的很简单就不废话了
连接给出 : http://msdn.microsoft.com/en-us/library/windowsphone/develop/jj207057(v=vs.105).aspx
