au回声

by Terren Peterson

由Terren Peterson

回声按钮如何将Amazon Alexa技能提升到新水平 (How Echo Buttons take Amazon Alexa Skills to a new level)

I’m recognized as an Amazon Alexa Champion and have published more than twenty custom skills on the platform. I continue to look for new ways to stretch this technology, create more robust skills, and share with the community.

我被公认为Amazon Alexa冠军,并且已经在平台上发布了二十多种自定义技能。 我继续寻找新方法来扩展该技术,创建更强大的技能并与社区分享。

Last September, Amazon released a new product for Alexa called Echo Buttons. These hardware devices expand the capabilities for the millions of customers that already have an Alexa. They’re relatively inexpensive, right now going for $20/2 pack.

去年9月 ,亚马逊为Alexa发布了一项名为Echo Buttons的新产品。 这些硬件设备为已经拥有Alexa的数百万客户扩展了功能。 它们相对便宜,目前每包20美元 。

In April of this year, Amazon opened up the platform for developers like me to begin incorporating them into custom skills. This is my experience so far programming with them.

今年4月 ,亚马逊为像我这样的开发人员开放了该平台,以开始将其纳入自定义技能中。 到目前为止,这是我与他们进行编程的经验。

回声按钮入门 (Getting Started with Echo Buttons)

Buttons are paired with Alexa devices through a bluetooth connection, becoming a physical extension of the speaker. All network traffic from the button to use Amazon services goes through the paired device. Don’t buy buttons if you don’t already have an Alexa, as they don’t do anything on their own.

按钮通过蓝牙连接与Alexa设备配对,成为扬声器的物理扩展。 从按钮使用Amazon服务的所有网络流量都通过配对的设备。 如果您还没有Alexa,请不要购买按钮,因为它们本身不会做任何事情。

If you have multiple speakers associated with your account, the button will only work with the device it’s currently paired with. The pairing can be undone with just a few steps on your phone. To unpair a device, just use the Alexa companion app and go into the settings section. Select the button that has already been paired, and it will release it. Then go back through the steps to repair to another device.

如果您有多个与您的帐户关联的发言人,则该按钮仅适用于当前与其配对的设备。 仅需几个步骤,即可取消配对。 要取消设备配对,只需使用Alexa配套应用程序并进入“设置”部分。 选择已经配对的按钮,它将释放它。 然后返回执行步骤以修复另一台设备。

This makes buttons an easy add on for Alexa enthusiasts, and makes them flexible for those with multiple devices.

这使得按钮对于Alexa发烧友来说是一个轻松的附加,并使它们对于使用多种设备的人来说非常灵活。

按钮如何与自定义技能互动 (How Buttons Interact with Custom Skills)

Alexa is an event driven architecture. Events are created by the sounds going into the speaker that are translated through Cloud based service. Normally these events are initiated after the array of microphones picks up a command from a user. These commands are then translated by the ASR (Automated Speech Recognition) models depending on which custom skill is being used.

Alexa是事件驱动的体系结构。 通过传入扬声器的声音创建事件,这些声音通过基于Cloud的服务进行翻译。 通常,这些事件是在麦克风阵列接收到用户的命令后启动的。 然后,根据所使用的自定义技能,由ASR(自动语音识别)模型转换这些命令。

With buttons, a new type of event is created that follows a similar pattern. When the button is pressed, an event is created and sent to the skill that runs in the Cloud. When the button is released, a separate event is created. These events are created independently of anything being picked up by the microphones on the Echo Speaker and flow through a Cloud based service called the Game Engine.

使用按钮,可以创建遵循类似模式的新型事件。 按下按钮后,将创建一个事件并将其发送到云中运行的技能。 释放按钮后,将创建一个单独的事件。 这些事件的创建与Echo Speaker上的麦克风所拾取的任何事物无关,并流经称为游戏引擎的基于云的服务。

The Lambda function that contains the logic for the custom skill needs to process these events along with the existing voice triggered ones. Translating request objects is facilitated by the Alexa SDK installed in the Lambda function. Examples of how this works are provided in the Alexa repo.

包含自定义技能逻辑的Lambda函数需要处理这些事件以及现有的语音触发事件。 Lambda函数中安装的Alexa SDK有助于翻译请求对象。 Alexa存储库中提供了有关此工作原理的示例。

This opens up new possibilities for gameplay, as a user can leverage both their voice and hands to interact with the skill. Engaging more senses broadens the experience, and enables more complex gaming. For example, in the Seventh Inning Stretch skill, a user can play a baseball game listening on their speaker while pressing the button to swing the bat.

这为用户提供了新的游戏可能性,因为用户可以利用自己的声音和手来与技能进行交互。 参与更多的感官可以扩大体验,并实现更复杂的游戏。 例如,在“ 第七局伸展”技能中 ,用户可以在按下按钮以挥动球棒的同时聆听其扬声器上的棒球比赛。

技能如何使用小工具API (How Skills use the Gadgets API)

Using buttons within a custom skill requires the Gadgets API. Documentation is currently on this website, and note that it is still in beta. Buttons are just a type of gadget, and provide a glimpse into what’s possible with enabled hardware.

在自定义技能中使用按钮需要Gadgets API。 文档目前在此网站上 ,请注意,该文件仍处于测试阶段。 按钮只是一种小工具,可让您一窥启用的硬件的功能。

Connectivity between systems is facilitated by interfaces across the internet. The API that buttons need is invoked by adding directive attributes to a standard Alexa response object. This enables the SDK to handle the explicit details for the HTTPS call (i.e. encoding the header, setting the attributes, error handling, etc.)

跨Internet的接口促进了系统之间的连接。 通过将指令属性添加到标准Alexa响应对象来调用按钮所需的API。 这使SDK可以处理HTTPS调用的显式详细信息(即,编码头,设置属性,错误处理等)。

Here is an example of adding a directive to set the lights on a button at the same time that the Echo speaker reads back an introduction to the user.

这是一个示例,其中添加了一条指令以在Echo扬声器向用户回读简介的同时设置按钮上的灯光。

"response": {               "shouldEndSession": false,               "outputSpeech": {                     "type": "SSML",                     "ssml": "<speak> Welcome back to Seventh Inning Stretch.<break time=\"1s\"/>We found an prior game in progress. Would you like to resume? </speak>"                 },               "reprompt": {                     "outputSpeech": {                           "type": "SSML",                           "ssml": "<speak> Say yes to resume the in-progress game, or no to delete it.  </speak>"                     }               },               "directives": [    {                           "type": "GadgetController.SetLight",                            "version": 1,                           "targetGadgets": [],                           "parameters": {                      "animations": [               {                         "repeat": 1,                            "targetLights": ["1"],              "sequence": [                          {                    "durationMs": 30000,                                                               "color": "FFFF00",                  "blend": false                                                     }              ]                      }           ],      "triggerEvent": "buttonDown",                                "triggerEventTimeMs": 0    }}

The Game Engine creates events just like the Echo speaker. The same taxonomy is used, and the attributes within the request identifies event details. Below is an example of a request indicating that a button was pressed.

游戏引擎会像回声扬声器一样创建事件。 使用相同的分类法,并且请求内的属性标识事件详细信息。 下面是指示按钮被按下的请求示例。

“request”: {   “type”: “GameEngine.InputHandlerEvent”,   “requestId”: “amzn1.echo-api.request.xxx”,   “timestamp”: “2018–07–21T21:33:25Z”,   “locale”: “en-US”,   “originatingRequestId”: “amzn1.echo-api.request.xxx”,   “events”: [     {       “name”: “button_down_event”,       “inputEvents”: [ {         “gadgetId”: “amzn1.ask.gadget.xxxx”,         “timestamp”: “2018–07–21T21:33:25.374Z”,         “color”: “000DD6”,         “feature”: “press”,         “action”: “down”       } ]     }   ] }

通过点名通话节省电池寿命 (Save Battery Life through Roll Call)

Echo Buttons are battery powered, making energy management important. When a custom skill requires a button, it must initiate a connection and wake the button. This is done through a process called ‘roll call’ within the custom skill.

回声按钮由电池供电,因此能源管理非常重要。 当自定义技能需要按钮时,它必须启动连接并唤醒按钮。 这是通过自定义技能中称为“滚动通话”的过程完成的。

To initiate a roll call in a custom skill, add a directive to the response object providing the parameters to perform the task. In parallel, audio instructions need to be included in the response object. These will encourage a user to do something with the buttons. For example, ask the user to press each button to get started.

要使用自定义技能启动点名,请将指令添加到响应对象,其中提供执行任务的参数。 并行地,音频指令需要包含在响应对象中。 这些将鼓励用户使用按钮做某事。 例如,要求用户按下每个按钮以开始使用。

For specifics on what a directive looks like, here is the roll call directive I use for my Seventh Inning Stretch skill. It’s a series of attributes in a large JSON object. This sets the timeout parameter for when the buttons can go back to sleep if not used (the 300,000 value is in milliseconds — this translates to five minutes), and looks for just the button down event.

有关指令的外观的详细信息,这是我用于第七局限弹力技巧的点名指令。 它是大型JSON对象中的一系列属性。 这将设置超时参数,用于不使用按钮时可以返回睡眠的时间(300,000的值以毫秒为单位-转换为五分钟),并且仅查找按钮按下事件。

"directives": [  {     “type”: “GameEngine.StartInputHandler”,     “timeout”: 300000,     “recognizers”: {       “button_down_recognizer”: {         “type”: “match”,         “fuzzy”: false,         “anchor”: “end”,         “pattern”: [{ “action”: “down” }]       }    },     “events”: {       “button_down_event”: {         “meets”: [“button_down_recognizer”],         “reports”: “matches”,         “shouldEndInputHandler”: false       },       “timeout”: {         “meets”: [“timed out”],         “reports”: “history”,         “shouldEndInputHandler”: true       }     }  }]

The buttons handle the timer for when to turn off. This minimizes the risk of battery drain when a user ends their session. Skills that use buttons should also make a request to the shut off the device if the skill is exited.

这些按钮用于控制计时器的关闭时间。 这样可以将用户结束会话时电池耗电的风险降到最低。 如果退出该技能,则使用按钮的技能还应请求关闭设备。

翻译游戏引擎事件 (Translating Game Engine Events)

The Game Engine can create events just like the speaker after it is awake. The request uses the same taxonomy, and the attributes identify details of the event. Here is an example of a request indicating that a button was pressed.

游戏引擎可以像清醒后的扬声器一样创建事件。 该请求使用相同的分类法,并且属性标识事件的详细信息。 这是指示按钮被按下的请求的示例。

“request”: {   “type”: “GameEngine.InputHandlerEvent”,   “requestId”: “amzn1.echo-api.request.xxx”,   “timestamp”: “2018–07–21T21:33:25Z”,   “locale”: “en-US”,   “originatingRequestId”: “amzn1.echo-api.request.xxx”,   “events”: [     {       “name”: “button_down_event”,       “inputEvents”: [ {         “gadgetId”: “amzn1.ask.gadget.xxxx”,         “timestamp”: “2018–07–21T21:33:25.374Z”,         “color”: “000DD6”,         “feature”: “press”,         “action”: “down”       } ]     }   ] }

The logic within the Lambda function for the skill will need to respond to these events, and process functionality accordingly.

Lambda函数中该技能的逻辑将需要响应这些事件,并相应地处理功能。

按钮可以改变颜色 (Buttons Can Change Color)

Inside the buttons are a series of LED’s that can be turned off and on. They are bright and the color is very rich.

按钮内部是一系列可以关闭和打开的LED。 它们明亮,色彩非常丰富。

The buttons can also change colors by altering how the different LED’s are illuminated.

这些按钮还可以通过更改不同LED的照明方式来更改颜色。

Color changing of the buttons is also done within directives in a response object. If you start your skill using the repo for buttons, there are helper functions that make this easy to integrate into your skill.

在响应对象的指令中也可以完成按钮的颜色更改。 如果您使用按钮的仓库开始您的技能,则可以使用帮助程序功能轻松将其集成到您的技能中。

闭幕 (Closing)

If you’re interested in trying out a game that uses them, please test out my baseball simulation game on Alexa. It’s called “Seventh Inning Stretch” and is an attempt to recreate the fun of old handheld games from the 80’s. It’s a good example of what’s possible using these new accessories.

如果您有兴趣尝试使用它们的游戏,请在Alexa上测试我的棒球模拟游戏。 它被称为“第七局延伸”,它试图重现80年代旧式掌上游戏机的乐趣。 这是使用这些新配件可能实现的一个很好的例子。

翻译自: https://www.freecodecamp.org/news/how-echo-buttons-take-amazon-alexa-skills-to-a-new-level-d4c489853b1f/

au回声

au回声_回声按钮如何将Amazon Alexa技能提升到新水平相关推荐

  1. 亚马逊echo中国使用_我如何编程我的第一个Amazon Alexa技能并赢得了免费的Echo Dot...

    亚马逊echo中国使用 by Lorrie Pearson 洛里·皮尔森(Lorrie Pearson) 我如何编程我的第一个Amazon Alexa技能并赢得了免费的Echo Dot (How I ...

  2. 旅游系统_数字洛江智慧旅游系统助力提升旅游安全水平

    长期以来,景区客流监测工作都是个"老大难"问题.为进一步提升旅游安全监管水平,今年洛江区将该项工作列入民办实事项目,投入96万元,大力推进智慧旅游项目建设. 日前,洛江区智慧旅游系 ...

  3. echo回声不能用了_回声消除的昨天、今天和明天

    导读:回声消除是音频通话中最为复杂的模块,对于音频通话质量起到至关重要的作用.一直以来,网易云信致力于提供良好的回声消除性能,为用户提供优异的音频通话质量.本篇文章中网易智企音视频开发专家将和大家共同 ...

  4. python 对话框的创建及调用_单击按钮创建新对话框

    我正在创建一个最初显示登录和注册按钮的应用程序. 点击登录,我想显示另一个屏幕(或对话框),这将允许用户输入用户名和密码.在 我想在第二个对话出现时隐藏第一个对话,但无法做到这一点 我们可以通过连接到 ...

  5. sonos qq音乐_如何在多个Amazon Echo扬声器上播放音乐(像Sonos)

    sonos qq音乐 Amazon is a little late to the whole-house audio party. Ecosystems like AirPlay and Sonos ...

  6. alexa技能个数_如何在您的技能中使用Alexa演示语言

    alexa技能个数 by Garrett Vargas 通过Garrett Vargas 如何在您的技能中使用Alexa演示语言 (How to use Alexa Presentation Lang ...

  7. swift建立桥接_在Swift中建立Alexa技能

    swift建立桥接 by Claus Höfele 通过克劳斯·霍费尔 在Swift中建立Alexa技能 (Building Alexa Skills in Swift) 如何使用Swift开发Ama ...

  8. alexa技能个数_如何使用Alexa蓝图创建自己的Alexa技能

    alexa技能个数 There are a ton of Alexa Skills that you can get for your Echo, but now you can create you ...

  9. 【智能语音】ROC-RK3308-CC Amazon Alexa固件发布

    ROC-RK3308-CC已支持Amazon Alexa语音服务,在Firefly 维基教程可下载ROC-RK3308-CC Alexa固件. 维基教程详细介绍了授权.配网.使用流程.编译方法等内容: ...

最新文章

  1. python如何下载tushare_安装tushare
  2. masonry的约束应该写在哪里_规划奇思|“中心城区”到底在哪里?和城镇开发边界是什么关系?...
  3. Codeforces 1264C/1265E Beautiful Mirrors with queries (概率期望、DP)
  4. DNS攻击的主要方式
  5. atitit. orm框架的hibernate 使用SQLQuery createSQLQuery addEntity
  6. 最短路径——Floyd算法及优化(蓝桥杯试题集)
  7. 三维数学基础(一)坐标系、向量、矩阵
  8. elementui时间线的使用~满满的干货,不要错过
  9. PDF怎么翻译成中文?这些方法值得收藏
  10. linux深度商店 apt,Deepin系统安装软件总结:通过商店、二进制包、deb包、终端命令安装...
  11. v-distpicker的使用
  12. 高拍仪二次开发(多浏览器,BS,Web)样例
  13. 免费好用的判定节假日API来了
  14. 问题 K: [入门OJ]开会时间(初中生请多多指教)
  15. WinMerge使用
  16. iOS应用组件化/模块化探究
  17. VC获取系统空闲时间
  18. 如何写SCI文章-转自知乎
  19. 计算机毕业设计之SSM的医院挂号就诊系统
  20. mac的python怎么输入中文_帮你解决mac上python没法输入中文问题

热门文章

  1. 蓝桥杯简单题之十六进制转八进制(JAVA版)
  2. javascript高级程序设计---模式设计
  3. 光纤宽带 和 ADSL宽带有什么区别?
  4. nodejs express搭建服务器(爬虫知乎精华帖,个人学习用)六 html
  5. 手把手教你通过单号查询快递物流信息
  6. 阿德莱德大学语言班成绩为C,2020年阿德莱德大学托福成绩要求分数是多少
  7. PL/SQL存储过程
  8. HTTP请求OPTION方法
  9. 计算机软件水平考试都是选择题吗,计算机软考选择题多少分一道?
  10. css多个属性怎么写,.css多个属性读取写法?