AVS之启用基于云端唤醒词验证(一)
2018-01-17 本文已影响138人
程序手艺人
云端唤醒词验证功能可以减少由与唤醒词相似的词造成的错误唤醒来提高启用了Alexa产品唤醒词准确性.例如,这里有几句话可能会导致误唤醒 “Alexa”: “Alex”, “election”, “Alexis”.云端唤醒词验证还检测媒体中提及的"Alexa".例如,在亚马逊广告中提及"Alexa".
通过产品上的唤醒词引擎进行初始化检测,然后在云中验证唤醒词.如果检测到误唤醒,AVS发送StopCapture 指令到产品的downchannel指示它关闭音频流,如果通过,则关闭蓝色LED以指示Alexa已经停止监听.
审查基于云端唤醒词验证的流媒体要求
当唤醒词引擎检测到如"Alexa"之类的唤醒词时,语音发起的产品开始将用户音频流发送到AVS,当用户停止说话或者用户的意图已经被识别并且服务返回一个StopCapture指令时该流被关闭.为了使云端唤醒词起作用,音频流传输到AVS的音频必须包括唤醒词,前置500ms以及捕获的任何用户语音,直到收到StopCapture指令.允许AVS验证包含在音频流中的唤醒词,减少了由于误唤醒而导致的错误响应的数量.
- 在检测到唤醒词之前捕获的音频或前置音频被用于校准记录的环境噪声等级,这样会增强了语音识别.
- 在流中包含唤醒词允许AVS执行基于云端的唤醒词验证,这减少了误唤醒.
- 如果在云端唤醒词验证期间未检测到唤醒词,则丢弃音频样本.
调整新的Context对象的客户端代码: RecognizerState
Context是一个容器,用于将客户端组件的状态传递给AVS. 为了支持基于云端的唤醒词验证,所有唤醒词使能的产品,无论如何与启动的Alexa交互,都需要发送新的Context对象, RecognizerState,与每个适用的事件.
注意:如果你的产品不启用云端唤醒词校验,这个对象则不请求.
以下是需要Context的事件列表:
- Recognize
- PlayCommandIssued
- PauseCommandIssued
- NextCommandIssued
- PreviousCommandIssued
- SynchronizeState
- ExceptionEncountered
示例消息
{
"header": {
"namespace": "SpeechRecognizer",
"name": "RecognizerState"
},
"payload": {
"wakeword": "ALEXA"
}
}
Payload参数
参数 | 描述 | 类型 |
---|---|---|
唤醒词 | 识别当前的唤醒词.Accepted Value: "ALEXA" | string |
示例
以下示例说明产品中启用唤醒词的SpeechRecognizer.Recognize事件
{
"context": [
{
"header": {
"namespace": "SpeechRecognizer",
"name": "RecognizerState"
},
"payload": {
"wakeword": "{{STRING}}"
}
},
{
"header": {
"namespace": "AudioPlayer",
"name": "PlaybackState"
},
"payload": {
"token": "{{STRING}}",
"offsetInMilliseconds": {{LONG}},
"playerActivity": "{{STRING}}"
}
},
{
"header": {
"namespace": "Alerts",
"name": "AlertsState"
},
"payload": {
"allAlerts": [
{
"token": "{{STRING}}",
"type": "{{STRING}}",
"scheduledTime": "{{STRING}}"
}
],
"activeAlerts": [
{
"token": "{{STRING}}",
"type": "{{STRING}}",
"scheduledTime": "{{STRING}}"
}
]
}
},
{
"header": {
"namespace": "Speaker",
"name": "VolumeState"
},
"payload": {
"volume": {{LONG}},
"muted": {{BOOLEAN}}
}
},
{
"header": {
"namespace": "SpeechSynthesizer",
"name": "SpeechState"
},
"payload": {
"token": "{{STRING}}",
"offsetInMilliseconds": {{LONG}},
"playerActivity": "{{STRING}}"
}
}
],
"event": {
"header": {
"namespace": "SpeechRecognizer",
"name": "Recognize",
"messageId": "{{STRING}}",
"dialogRequestId": "{{STRING}}"
},
"payload": {
"profile": "{{STRING}}",
"format": "{{STRING}}"
}
}
}