百度AI---语音识别
2024-09-05 11:57:51
题记:娱乐性的玩玩百度接口。
说实话,其接口个人觉得有点烂,重试了好几个音频文件才成功。
1、重新申请AppID、SecretKey 、API Key。
链接:https://console.bce.baidu.com/ai/?fromai=1#/ai/speech/overview/index
2、百度的案例代码
/**
* 语音识别
*/
public static void voiceRecongnize(){
AipSpeech client = new AipSpeech(BaiduConfig.VOICE_APP_ID, BaiduConfig.VOICE_API_KEY, BaiduConfig.VOICE_SECRET_KEY);//这个要自己写哦
String path = "C:\\Users\\yangwj\\Desktop\\temp.wav";
try{
JSONObject asrRes = client.asr(path, "wav", 16000, null);
System.out.println(asrRes); // 对语音二进制数据进行识别
byte[] data = Util.readFileByBytes(path); //readFileByBytes仅为获取二进制数据示例
JSONObject asrRes2 = client.asr(data, "pcm", 16000, null);
System.out.println(asrRes2);
}catch (Exception e){
e.printStackTrace();
}
}
这样就可以调用运行了。
最新文章
- 非RootLayer的隐式动画
- 搞不清FastCgi与PHP-fpm之间是个什么样的关系?
- Android基础学习第一篇—Project目录结构
- Java this的一两点使用
- [原创]Mac系统下制作OS 10.11安装镜像
- Linux内核中断学习
- editplus如何配置php编译环境?
- 浏览器JS脚本
- [转载]Spring Autowire自动装配介绍
- SQL Server select into/bulkcopy用法
- cplusplus解析
- 【转】shell 教程——04 什么时候使用Shell
- Dalvik虚拟机的优化机制
- not accessible due to restriction on required library
- Elasticsearch .net 客户端条件拼接查询
- CSS居中的几种方式总结
- Android 架构 -- Room
- 使用Hexo+Github搭建属于自己的博客(基础)
- Page11:状态反馈、输出反馈的概念及性能比较,极点配置的基本概念、意义及其算法[Linear System Theory]
- 好用的图片缩放JS
热门文章
- Visual Studio 2019社区版:错误 MSB6006 “CL.exe”已退出,代码为 2
- 2019ICPC南京网络赛A题 The beautiful values of the palace(三维偏序)
- java中activiti框架中的排他网关使用方法,多条件判断
- .NET Core 3时代!如何使用DevExpress WPF创建应用
- 决策树--CART树详解
- 【51nod 2004】终结之时
- oracle rowtype
- 什么是URL百分号编码?
- 安装java1.8.0
- UCenter网站部署