您的位置:首页 > 其它

Text to speech语音 Windows phone

2015-12-26 13:04 369 查看
using System;

using System.Collections.Generic;

using System.Linq;

using System.Text;

using System.Threading.Tasks;

using Windows.Phone.Speech.Synthesis;

namespace Flashcard

{

class Text_to_speech

{

private static Text_to_speech uniqueInstance;

private SpeechSynthesizer _speechSynthesizer;//声明音响合成器

private Text_to_speech() {

_speechSynthesizer = new SpeechSynthesizer();

}

public static Text_to_speech getInstance() {

if (uniqueInstance == null) {

uniqueInstance = new Text_to_speech();

}

return uniqueInstance;

}

public async void _text_to_speak(string text) {

try {

if (!string.IsNullOrEmpty(text))

{

await _speechSynthesizer.SpeakTextAsync(text);

}

else {

}

}

catch(Exception ex){

}

}

}

}
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签:  语音windows