### 3.5.6 Smart Audio
#### (1)功能说明
模糊场景下抽取聊天关键词,智能推荐儿童听听中相关的有声资源。数据主要来自工程师爸爸、喜马拉雅FM和蜻蜓FM,返回url包含mp3和m4a两种格式。
#### (2) 接口说明
**请求方法**
* POST
**请求地址**
* [http://api.ruyi.ai/v1/message](http://api.ruyi.ai/v1/message)
**请求参数说明**
| 参数名 | 参数类型 | 是否必须 | 参数说明 |
| :--- | :--- | :---: | :--- |
| q | String | 是 | 自然语言表达,例如“宝宝要听儿歌”等 |
| app\_key | String | 是 | 应用开发者秘钥,注册开发者后台账号,建立虚拟助理后获得 |
| user\_id | String | 是 | 用户唯一标识,便于支持个性化语义解析。建议开发者使用 UUID 字符,且不同用户必须用不同的 user\_id,防止意图串。 |
#### (3) 返回说明
**返回参数说明**
| 名称 | 类型 | 说明 |
| :--- | :--- | :--- |
| code | Integer | 返回代码 |
| msg | String | 返回代码描述 |
| parameters | JSON Object | 解析到的实体以及服务说明 |
| action | String | 服务的接口名称 |
| name | String | 匹配的意图名称 |
| result | JSON Object | 接口返回内容 |
| outputs | Array | 服务输出结果,微信端使用 type 类型为 wechat 开头的内容;硬件端收到所有内容,依据需求解析使用 |
**返回代码说明**
| 返回代码 | 错误类型 | 说明 |
| :--- | :--- | :--- |
| 0/200 | 成功 | 请求成功 |
| 400 | 无效请求 | 某些必需参数缺失或参数值错误,详见msg字段 |
| 401 | 未授权 | 授权失败,app\_key 缺失或错误 |
| 403 | 请求被禁止 | 有效请求,但服务拒绝响应,请联系contact@ruyi.ai |
| 408 | 请求超时 | 请求响应超时,一般响应时间设置为2000ms以内 |
| 429 | 短时间内大量访问 | 短时间内请求数过多 |
| 500 | 内部错误 | 服务处理异常 |
| 503 | 服务不可用 | 服务异常或正在维护 |
#### (4) 请求示例
**请求范例**
_宝宝要听儿歌_
**请求示例**
(成功,返回符合结果的单曲,和该单曲所在专辑最多10个曲目的播放列表)
* http://api.ruyi.ai/ruyi-api/v1/message?app_key=APP_KEY&user_id=user0&q=宝宝要听儿歌
返回结果
```
{
"code": 0,
"msg": "ok",
"result": {
"_text": "宝宝要听儿歌",
"msg_id": "5a6f63d9-5945-41fe-9041-9f5e3e98c160",
"intents": [{
"parameters": {
"statedIn": "",
"tag": "儿歌",
"service": "smart_audio"
},
"action": "smart-audio",
"name": "smart audio",
"result": {
"code": 200,
"response": {
"code": 0,
"msg": "成功",
"result": {
"track_list": [{
"name": "嘟拉儿歌 024打电话",
"@type": ["MusicRecording", "CreativeWork", "Thing"],
"mergedFrom": [{
"inAlbum": {
"name": "嘟拉儿歌",
"identifier": "4021184",
"image": "http://fdfs.xmcdn.com/group11/M00/35/FE/wKgDa1cN68HwdMK_AARP3SWiU0Q661_mobile_meduim.png",
"@type": ["MusicAlbum", "CreativeWork", "Thing"]
},
"identifier": "22167041",
"position": 2,
"durationInSeconds": 196,
"statedIn": "www.ximalaya.com",
"@type": ["MusicRecording", "CreativeWork", "Thing"],
"audio": [{
"contentUrl": "http://fdfs.xmcdn.com/group19/M01/34/13/wKgJJlfofFbjXj-sABfyX9-X3ng503.mp3",
"encodingFormat": "mp3"
}, {
"contentUrl": "http://audio.xmcdn.com/group19/M01/33/D9/wKgJK1fofFiAw7BRABhA1fKMiCY986.m4a",
"encodingFormat": "m4a"
}]
}]
}, {
"name": "英语儿歌-This Is The Way",
"@type": ["MusicRecording", "CreativeWork", "Thing"],
"mergedFrom": [{
"inAlbum": {
"name": "精选英语儿歌",
"identifier": "4383321",
"image": "http://fdfs.xmcdn.com/group14/M01/7B/10/wKgDZFdF0rrwbrYdAAF88Pre0-Y561_mobile_meduim.jpg",
"@type": ["MusicAlbum", "CreativeWork", "Thing"]
},
"identifier": "16226785",
"position": 8,
"durationInSeconds": 61,
"statedIn": "www.ximalaya.com",
"@type": ["MusicRecording", "CreativeWork", "Thing"],
"audio": [{
"contentUrl": "http://fdfs.xmcdn.com/group14/M05/7B/1E/wKgDY1dF1H7j0W3JAAd0OedfpOo299.mp3",
"encodingFormat": "mp3"
}, {
"contentUrl": "http://audio.xmcdn.com/group14/M05/7B/1E/wKgDY1dF1HyCsCEUAAePO3oZj-s716.m4a",
"encodingFormat": "m4a"
}]
}]
}, {
"name": "你好,花木兰",
"@type": ["MusicRecording", "CreativeWork", "Thing"],
"mergedFrom": [{
"inAlbum": {
"name": "兔小贝儿歌-2",
"identifier": "246643",
"image": "http://fdfs.xmcdn.com/group5/M01/5D/18/wKgDtVOs1AORmriMAAFwDkni1vo926_mobile_meduim.png",
"@type": ["MusicAlbum", "CreativeWork", "Thing"]
},
"identifier": "23942470",
"position": 160,
"durationInSeconds": 249,
"statedIn": "www.ximalaya.com",
"@type": ["MusicRecording", "CreativeWork", "Thing"],
"audio": [{
"contentUrl": "http://fdfs.xmcdn.com/group25/M06/00/09/wKgJNlgQDlnzPZ9zAB6CXyVOcsc534.mp3",
"encodingFormat": "mp3"
}, {
"contentUrl": "http://audio.xmcdn.com/group25/M06/00/0C/wKgJMVgQDlnTNMFPAB7j0QbIF3M384.m4a",
"encodingFormat": "m4a"
}]
}]
}, {
"name": "【米粒妈分享】A-Hunting We Will Go",
"@type": ["MusicRecording", "CreativeWork", "Thing"],
"mergedFrom": [{
"inAlbum": {
"name": "【最全】迪士尼最佳英文儿歌合集,宝贝磨耳朵必备!",
"identifier": "3934688",
"image": "http://fdfs.xmcdn.com/group28/M09/7E/3D/wKgJXFkpAQ6x0ytGAAEWn_yKL9Q801_mobile_meduim.jpg",
"@type": ["MusicAlbum", "CreativeWork", "Thing"]
},
"identifier": "16423524",
"position": 31,
"durationInSeconds": 74,
"statedIn": "www.ximalaya.com",
"@type": ["MusicRecording", "CreativeWork", "Thing"],
"audio": [{
"contentUrl": "http://fdfs.xmcdn.com/group13/M02/80/A7/wKgDXldLvRmA6vNTAAkggKfpwX8291.mp3",
"encodingFormat": "mp3"
}, {
"contentUrl": "http://audio.xmcdn.com/group13/M02/80/BA/wKgDXVdLvRqxAKAwAAlCWmwaX_k513.m4a",
"encodingFormat": "m4a"
}]
}]
}, {
"name": "Track 11",
"@type": ["MusicRecording", "CreativeWork", "Thing"],
"mergedFrom": [{
"inAlbum": {
"name": "字母舞蹈",
"identifier": "3337772",
"image": "http://fdfs.xmcdn.com/group13/M06/C9/24/wKgDXVZq5MeTEYEhAAd-3wcoPkk402_mobile_meduim.jpg",
"@type": ["MusicAlbum", "CreativeWork", "Thing"]
},
"identifier": "10711341",
"position": 125,
"durationInSeconds": 46,
"statedIn": "www.ximalaya.com",
"@type": ["MusicRecording", "CreativeWork", "Thing"],
"audio": [{
"contentUrl": "http://fdfs.xmcdn.com/group8/M05/C8/E5/wKgDYVZq58CgFO1hAAWrvAtUjSI112.mp3",
"encodingFormat": "mp3"
}, {
"contentUrl": "http://audio.xmcdn.com/group9/M09/C9/0A/wKgDYlZq6CGA4LPMAAXCcwnzoVg964.m4a",
"encodingFormat": "m4a"
}]
}]
}, {
"name": "Christopher columbus小菲清唱",
"@type": ["MusicRecording", "CreativeWork", "Thing"],
"mergedFrom": [{
"inAlbum": {
"name": "My very first mother goose鹅妈妈经典童谣",
"identifier": "292196",
"image": "http://fdfs.xmcdn.com/group4/M05/8F/25/wKgDtFROOPnB91Q4AAKR5JSs4V4538_mobile_meduim.jpg",
"@type": ["MusicAlbum", "CreativeWork", "Thing"]
},
"identifier": "4601517",
"position": 17,
"durationInSeconds": 22,
"statedIn": "www.ximalaya.com",
"@type": ["MusicRecording", "CreativeWork", "Thing"],
"audio": [{
"contentUrl": "http://fdfs.xmcdn.com/group5/M05/D5/69/wKgDtVSIcUigo85WAAK7ZOMQWsE524.mp3",
"encodingFormat": "mp3"
}, {
"contentUrl": "http://audio.xmcdn.com/group16/M03/4F/89/wKgDbFWzXZWQetykAALHiOMimWU784.m4a",
"encodingFormat": "m4a"
}]
}]
}, {
"name": "61 Roses Are Red",
"@type": ["MusicRecording", "CreativeWork", "Thing"],
"mergedFrom": [{
"inAlbum": {
"name": "鹅妈妈童谣",
"identifier": "374575",
"image": "http://fdfs.xmcdn.com/group6/M02/FC/12/wKgDhFUjex_BYZlpAAIHxs7Ciy0600_mobile_meduim.jpg",
"@type": ["MusicAlbum", "CreativeWork", "Thing"]
},
"identifier": "6140840",
"position": 59,
"durationInSeconds": 19,
"statedIn": "www.ximalaya.com",
"@type": ["MusicRecording", "CreativeWork", "Thing"],
"audio": [{
"contentUrl": "http://fdfs.xmcdn.com/group6/M0A/FC/1C/wKgDhFUjfiGAV6ElAAJUhCpSQ68311.mp3",
"encodingFormat": "mp3"
}, {
"contentUrl": "http://audio.xmcdn.com/group16/M0B/3D/4E/wKgDbFWd8jHBZWkKAAJhQhdhMoo401.m4a",
"encodingFormat": "m4a"
}]
}]
}, {
"name": "192 照相机",
"@type": ["MusicRecording", "CreativeWork", "Thing"],
"mergedFrom": [{
"inAlbum": {
"name": "洪恩宝宝乐500首(1-200)",
"identifier": "342560",
"image": "http://fdfs.xmcdn.com/group6/M09/27/3A/wKgDhFTcOMeTS1VfAACyKRebLBQ387_mobile_meduim.jpg",
"@type": ["MusicAlbum", "CreativeWork", "Thing"]
},
"identifier": "5463588",
"position": 8,
"durationInSeconds": 15,
"statedIn": "www.ximalaya.com",
"@type": ["MusicRecording", "CreativeWork", "Thing"],
"audio": [{
"contentUrl": "http://fdfs.xmcdn.com/group6/M03/27/F2/wKgDhFTcXgDCPF6xAAHnhcYY3Ag933.mp3",
"encodingFormat": "mp3"
}, {
"contentUrl": "http://audio.xmcdn.com/group14/M03/34/58/wKgDY1WTj_Lg1C3CAAHyupceCd8146.m4a",
"encodingFormat": "m4a"
}]
}]
}, {
"name": "1-Make A Circle",
"@type": ["MusicRecording", "CreativeWork", "Thing"],
"mergedFrom": [{
"inAlbum": {
"name": "DrBing分级儿歌-1",
"identifier": "365808",
"image": "http://fdfs.xmcdn.com/group6/M02/C1/2B/wKgDhFUSfurydvNlAAB9piO_Oqo498_mobile_meduim.jpg",
"@type": ["MusicAlbum", "CreativeWork", "Thing"]
},
"identifier": "5990015",
"position": 20,
"durationInSeconds": 64,
"statedIn": "www.ximalaya.com",
"@type": ["MusicRecording", "CreativeWork", "Thing"],
"audio": [{
"contentUrl": "http://fdfs.xmcdn.com/group6/M04/C5/2F/wKgDg1USfabx3Uh-AAfoyST7aco674.mp3",
"encodingFormat": "mp3"
}, {
"contentUrl": "http://audio.xmcdn.com/group11/M03/29/35/wKgDa1WFRhKwCHhhAAgFSLyhO8Y130.m4a",
"encodingFormat": "m4a"
}]
}]
}, {
"name": "03 Animal Song",
"@type": ["MusicRecording", "CreativeWork", "Thing"],
"mergedFrom": [{
"inAlbum": {
"name": "Wee Sing- Animals, Animals, Animals 动物大游行",
"identifier": "4091469",
"image": "http://fdfs.xmcdn.com/group14/M0B/48/9E/wKgDZFcRtd3gRkGhAAFm9FPtak4573_mobile_meduim.jpg",
"@type": ["MusicAlbum", "CreativeWork", "Thing"]
},
"identifier": "14479942",
"position": 1,
"durationInSeconds": 38,
"statedIn": "www.ximalaya.com",
"@type": ["MusicRecording", "CreativeWork", "Thing"],
"audio": [{
"contentUrl": "http://fdfs.xmcdn.com/group8/M03/47/26/wKgDYFcRtjzS3GIPAASx5GHNcso456.mp3",
"encodingFormat": "mp3"
}, {
"contentUrl": "http://audio.xmcdn.com/group8/M03/47/25/wKgDYVcRtj3ijp3dAATFnw0RAPQ472.m4a",
"encodingFormat": "m4a"
}]
}]
}],
"msg": "ok"
}
},
"text": "即将播放【嘟拉儿歌 024打电话】",
"type": "dialog"
},
"outputs": [{
"type": "wechat.text",
"property": {
"text": "即将播放【嘟拉儿歌 024打电话】"
}
}, {
"type": "dialog",
"property": {
"text": "即将播放【嘟拉儿歌 024打电话】",
"emotion": "calm"
}
}],
"score": "1.0",
"scoreColor": "c4",
"is_match": 1,
"skill_id": "afc2b4c4-77fc-4117-af0d-9ea6f3f150a6",
"id": "b9423786-9aa0-45a2-ba30-f7100b47688c"
}],
"meta_process_milliseconds": 307
}
}
```
**详细参数说明**
| 名称 | 类型 | 说明 |
| :--- | :--- | :--- |
| service | String | 服务名称 |
|tag|String | 标签名,包含儿歌、故事、国学、诗词等,多个标签用后缀1,2...数字区分 |
|trackName|String |识别到的音频名称|
|statedIn|String |数据来源网站|
|track_list|String |返回的音频列表|
|name|String |音频名称|
|@type|String |实体类型|
|identifier|String|数据来源网站ID|
|durationInSeconds|String|音频时长|
|position|String|音频在专辑中的位置|
|inAlbum|String|音频所在专辑|
|image|String | 专辑封面地址 |
- 1. 海知智能第三方技能插件开放平台概述
- 2. 快速接入API
- 2.1 硬件接口调用
- 2.2 快速接入微信
- 2.3 API接入常见问题
- 3. 技能插件
- 3.1 基础能力类
- 顶级过滤器
- 用户知识图谱
- 机器人档案
- 通用闲聊
- 儿童闲聊
- Smart Reply
- 轻量闲聊
- 3.2 语音游戏类
- 成语接龙
- 词汇乐园
- 词语接龙
- 鹦鹉学舌
- 动脑猜猜
- 挑战单词
- 冒险世界
- 猜猜我是谁
- 阿拉丁学诗词
- 猫猫托管所
- 漂流瓶
- 诗词大会
- 国学大会
- 我爱猜歌名
- 我在看着你
- 灯谜猜猜
- 3.3 休闲娱乐类
- 星座运势
- 悦耳声音
- 幸运签
- 调教机器人
- 娱乐推送
- 3.4 生活服务类
- 黄历
- 计算器
- 古诗词
- 时间询问
- 翻译类技能
- 天气资讯
- 日程创建
- 日程创建指令
- 闹钟
- 食材知识
- 冥想音乐
- 格言
- 每日英语
- 汉语词典
- 豆果菜谱
- 古文翻译
- 3.5 音频点播类
- 喜马拉雅FM
- 新闻广播
- 音乐点播
- Smart Music
- 儿童听听
- Smart Audio
- 儿童笑话
- 点播控制指令
- 3.6 视频点播类
- 影视点播
- 3.7 百科知识类
- 人物百科
- 百科问答
- 实时百科
- 3.8 体育健康类
- 五分钟健身
- 4. 开发者初级教程
- 4.1 开通服务
- 4.2 创建机器人
- 4.3 设置机器人
- 4.4 获取技能插件
- 4.5 让机器人学会聊天
- 4.6 导入知识库
- 4.7 多种问答形式
- 4.8 数据统计
- 4.9 粉丝管理
- 5. 开发者中级教程
- 5.1 词典运用
- 5.2 意图处理
- 5.3 暗号使用
- 5.4 事件触发
- 5.5 优先级
- 5.6 触发器
- 5.7 快捷键
- 5.8 意图报错
- 6. 开发者高级教程
- 6.1 handlebars模版语言
- 6.2 JavaScript简单介绍
- 6.3 JavaScript使用说明
- 6.4 JavaScript使用案例
- 6.5 JavaScript常见问题
- 7. 快速发布技能
- 8. 帮助中心
- 8.1 常见概念
- 8.2 帮助视频
- 8.3 联系我们