c# winform播放声音的两种方式

 axWindowsMediaPlayer1.settings.setMode("", true);

axWindowsMediaPlayer1.URL = "skcg.mp3";

//等待时间大概2秒

//异步,主程序不会卡住

//生成语音网址  https://developer.baidu.com/vcast

 

using System.Speech.Synthesis;

SpeechSynthesizer synth = new SpeechSynthesizer();
synth.Speak("刷卡成功!");

//等待时间大概1.1秒

//同步,主程序会卡住

 

posted @ 2018-09-17 21:11  杨松岩  阅读(3044)  评论(0编辑  收藏  举报