惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

腾讯CDC
OSCHINA 社区最新新闻
OSCHINA 社区最新新闻
博客园 - 叶小钗
人人都是产品经理
人人都是产品经理
博客园 - 聂微东
The Cloudflare Blog
爱范儿
爱范儿
阮一峰的网络日志
阮一峰的网络日志
WordPress大学
WordPress大学
小众软件
小众软件
博客园 - 三生石上(FineUI控件)
Last Week in AI
Last Week in AI
Jina AI
Jina AI
V
V2EX
罗磊的独立博客
V
Visual Studio Blog
A
About on SuperTechFans
IT之家
IT之家
P
Proofpoint News Feed
B
Blog
博客园 - Franky
Blog — PlanetScale
Blog — PlanetScale
Google DeepMind News
Google DeepMind News
Y
Y Combinator Blog

博客园 - 深圳大漠

Windows Server 2022 安装 SqlServer2000 Windows 11 登录后黑屏,只有一个可以移动的鼠标 SqlServer查数据表的记录数 Swagger UI 报错 Flutter升级错误 Error: failed to push some refs to ORA-28040: 没有匹配的验证协议 CS8600错误 如何让MAUI项目打包成apk而不是abb The current Gradle version 5.6.2 is not compatible with the Kotlin Gradle plugin. Please use Gradle 6.1.1 or newer, or the previous version of the Kotlin plugin Flutter常见错误记录 VSCode设置Flutter(Dart)自动折行宽度 analysis_options.yaml Fiddler抓HttpClient的包 VSCode开发WebApi EFCore的坑 Connection closed before full header was received SqlServer报错:指定的网络名不再可用 Flutter Build apk 错误(一) 修改项目语言为C#8.0
百度语音合成调用DEMO
深圳大漠 · 2020-12-20 · via 博客园 - 深圳大漠
百度语音合成,没有粤语,只得放弃。
讯飞的粤语包太贵,第二年收费2万,只好选择阿里。

//百度语音合成调用DEMO
public class BaiduVoice { // 设置APPID/AK/SK public string APP_ID = "<Your App ID>"; public string API_KEY = "<Your API Key>"; public string SECRET_KEY = "<Your Secret Key>"; public void Play(string text) { if (!Directory.Exists(@"d:\temp")) { Directory.CreateDirectory(@"d:\temp"); } var client = new Baidu.Aip.Speech.Tts(API_KEY, SECRET_KEY); client.Timeout = 60000;  // 修改超时时间 // 可选参数 var option = new Dictionary<string, object>() { {"spd", 4}, // 语速 {"vol", 5}, // 音量 {"per", 2 }  // 发音人,4:情感度丫丫童声 }; //var result = client.Synthesis("请注意,请张三到四号窗口办理业务,谢谢", option); var result = client.Synthesis(text, option); if (result.ErrorCode == 0)  // 或 result.Success { string fileName = $@"d:\temp\{Guid.NewGuid()}.mp3"; File.WriteAllBytes(fileName, result.Data); Mp3Player mp3Play = new Mp3Player() { FileName = fileName, }; mp3Play.play(); } else { MsgBox.Show(JsonConvert.SerializeObject(result)); } } }