天天看点

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秒

//同步,主程序会卡住

转载于:https://www.cnblogs.com/yangsongyan/p/9664932.html

c#