火山安卓调用讯飞语音识别教程
本帖最后由 雾里观花 于 2020-7-19 22:55 编辑本教程来自[创码教育_利快云教育]平台@仰望发布
转载请注释:来源
一、布局配置
①用到线性布局器、文本框、编辑框、按钮、进度对话框类、简单下拉列表框,按下图布局
https://www.lkuaiy.com/image/editor/15951140797666.png
②配置讯飞语音支持库,创建讯飞语音对象变量
https://www.lkuaiy.com/image/editor/15951140974189.png
https://www.lkuaiy.com/image/editor/15951141057956.png
二、文本转语音
①"通知_被创建"事件下,先初始化语音引擎
https://www.lkuaiy.com/image/editor/15951141232102.png
③创建列表事件
https://www.lkuaiy.com/image/editor/15951141397887.png
https://www.lkuaiy.com/image/editor/15951141483674.png
https://www.lkuaiy.com/image/editor/15951141543966.gif
④设置按钮事件
先检查是否有网络,然后开始转换语音
红箭头处是窗口2的功能,下面会讲到
https://www.lkuaiy.com/image/editor/15951141675676.png
⑤设置讯飞事件
https://www.lkuaiy.com/image/editor/15951141822147.png
https://www.lkuaiy.com/image/editor/15951141942133.png
https://www.lkuaiy.com/image/editor/15951142023987.png
三、语音识别
①新建一个窗口(Ctrl D)
https://www.lkuaiy.com/image/editor/15951142139779.png
②布局界面
添加按钮和编辑框,布局如下图
并创建讯飞识别对象类变量
https://www.lkuaiy.com/image/editor/15951142285427.png
https://www.lkuaiy.com/image/editor/15951142435883.png
③按钮事件下创建识别功能
https://www.lkuaiy.com/image/editor/15951142653183.png
④同样的,给讯飞识别对象添加事件
https://www.lkuaiy.com/image/editor/15951143361626.png
https://www.lkuaiy.com/image/editor/15951143462637.png
https://www.lkuaiy.com/image/editor/15951143565170.png
四、演示效果
这里只能演示过程,听不到声音,具体请安装到手机测试
https://www.lkuaiy.com/image/editor/15951143679597.gif
来自源贴:源文章教程地址
日常一顶 火山有你更精彩 日常一顶 我说”白日依山尽“的识别结果是如下的JSON字符串,怎么从中提取文字呢?
{"sn":1,"ls":false,"bg":0,"ed":0,"ws":[{"bg":69,"cw":[{"sc":0.0,"w":"白日"}]},{"bg":141,"cw":[{"sc":0.0,"w":"依"}]},{"bg":169,"cw":[{"sc":0.0,"w":"山"}]},{"bg":197,"cw":[{"sc":0.0,"w":"尽"}]}]}
{"sn":2,"ls":true,"bg":0,"ed":0,"ws":[{"bg":236,"cw":[{"sc":0.0,"w":"。"}]}]} 谢谢谢谢谢谢谢谢谢谢谢谢谢谢
页:
[1]