设为首页 加入收藏

TOP

C# winform语音提示
2019-09-17 15:14:17 】 浏览:10
Tags:winform 语音 提示

1.SpeechSynthesizer文字转音频

项目添加引用:System.Speech

using(SpeechSynthesizer speech = new SpeechSynthesizer)

{

  speech.Rate = 0;  //语速

  speech.Volume = 100;  //音量

  speech.Speak("要播放的文字");

}

 

 

2.SoundPlayer播放本地音频

项目添加引用→COM类型库:Windows Media Player

SoundPlayer play = new SoundPlayer();

play.SoundLocation = AppDomain.CurrentDomain.BaseDirectory + "music.wav"; //本地音频位置,这里放在了当前项目bin→debug下

play.Load();  //加载声音

play.Play(); //播放

 

】【打印繁体】【投稿】【收藏】 【推荐】【举报】【评论】 【关闭】 【返回顶部
上一篇C#根据流下载文件 下一篇ASP.NET Core 开发人员异常页面

最新文章

热门文章

Hot 文章

Python

C 语言

C++基础

大数据基础

linux编程基础

C/C++面试题目