1. 概要
CES2017でもAlexaがいたるところで使われていたということで、Raspberry Pi 3で動かしてみました。
その中でwakeWordAgentの期限切れのエラーに遭遇したので、その解決策を書いておきます。
基本的には以下のサイトに書いてある内容です。
https://github.com/Sensory/alexa-rpi#frequently-asked-questions
2. Alexaの導入方法
動かし方は以下のサイトに丁寧に書いてあるので、省略します。
Raspberry Pi · alexa/alexa-avs-sample-app Wiki
3. wakeWordAgentの期限切れエラー
上記サイトのSTEP7でターミナルウィンドウを3つ立ち上げるのですが、3つ目のターミナルで以下のようなエラーに遭遇しました。
pi@raspberrypi:~/Desktop/alexa-avs-sample-app/samples/wakeWordAgent/src $ ./wakeWordAgent -e sensory
INFO:main: Starting Wake Word Agent
INFO:WakeWordAgent: State set to IDLE(2)
INFO:Initializing Sensory library | library name: TrulyHandsfree | library version: 5.0.0-avs.1 | model file: ../ext/resources/spot-alexa-rpi.snsr
WARNING:Library expires on: License expires on 28 May 2017 00:00:00 GMT
ALSA lib pcm_hw.c:1667:(_snd_pcm_hw_open) Invalid value for card
wakeWordAgent: pcm.c:694: snd_pcm_close: Assertion `pcm' failed.
中止
4. 解決方法
エラー内容を検索してみると同じような現象が起きている人がいます。
- Raspberry piでAmazon Echo(AVS)を動かしてみる未遂 - Qiita
- Sensory Wake Word engine · Issue #284 · alexa/alexa-avs-sample-app
2つ目のページに解決策として別のページへのリンクが貼ってありました。
「2. The library license key has expired. How do I extend it?」に沿って対応してみます。
まずはクローンします。
git clone https://github.com/Sensory/alexa-rpi.git
そして手順に沿ってlicense.shを走らせます。
pi@raspberrypi:~/alexa-rpi $ ./bin/license.sh
ライセンスアグリーメントが長々と出てきます。
The Sensory TrulyHandsfree binaries are not licensed.
Press RETURN to review the license agreement and update the files.
Sensory Trulyhandsfree™ Library License
全部読んで、yesで同意します。
Do you accept this license agreement? [yes or no]: yes
License key applied.
その後はファイルをコピーします。
pi@raspberrypi:~/alexa-rpi $ cp ./lib/libsnsr.a ~/Desktop/alexa-avs-sample-app/samples/wakeWordAgent/ext/lib/
pi@raspberrypi:~/alexa-rpi $ cp ./models/*.snsr ~/Desktop/alexa-avs-sample-app/samples/wakeWordAgent/ext/resources/
pi@raspberrypi:~/alexa-rpi $ cp ./models/spot-alexa-rpi-31000.snsr ~/Desktop/alexa-avs-sample-app/samples/wakeWordAgent/ext/resources/spot-alexa-rpi.snsr
3つ目のspot-alexa-rpi-31000.snsrというファイルは他にも2種類あって、性能が違うようです。
詳しい違いは以下の項目を見てください。
この後、改めてSTEP6を実行します。(私の場合は、途中で固まってしまったためRaspberry Piを再起動しました。)
cd ~/Desktop/alexa-avs-sample-app
. automated_install.sh
再びSTEP7を実行したところ以下の表示になりました。
動いているような気がしますが、まだ期限切れのエラーが出ているのも気になります…。
「Alexa」の呼びかけには反応がありません。2つ目のターミナルを実行した際に立ち上がるウィンドウの「Listen」ボタンを押して「what's the time?」などと聞くと反応はあります。
pi@raspberrypi:~/Desktop/alexa-avs-sample-app/samples $ cd wakeWordAgent/src && ./wakeWordAgent -e sensory
INFO:main: Starting Wake Word Agent
INFO:WakeWordAgent: State set to IDLE(2)
INFO:Initializing Sensory library | library name: TrulyHandsfree | library version: 5.0.0-avs.1 | model file: ../ext/resources/spot-alexa-rpi.snsr
WARNING:Library expires on: License expires on 28 May 2017 00:00:00 GMT
INFO:SensoryWakeWordEngine: mainLoop thread started
INFO:WakeWordIPCSocket::mainLoop thread started
INFO:WakeWordIPCSocket: init socket on port:5123
INFO:WakeWordAgent: thread started
INFO:===> Connected to AVS client <===
気を取り直して、もう少しかっこよく呼びかけてみたところ反応してくれました。
Listenボタンを押した時と同じ状態になります。
3つ目のターミナルに表示される内容は以下のとおりです。
INFO:===> WakeWordAgent: wake word detected <===
INFO:WakeWordAgent: State set to WAKE_WORD_DETECTED(3)
INFO:WakeWordAgent: State set to SENT_WAKE_WORD_DETECTED(4)
INFO:WakeWordAgent: IPC Command received:3
INFO:WakeWordAgent: State set to WAKE_WORD_PAUSE_REQUESTED(5)
INFO:SensoryWakeWordEngine: handling pause
INFO: *** THREAD JOINING: Sensory ***
INFO:SensoryWakeWordEngine: mainLoop thread ended
INFO:WakeWordAgent: State set to WAKE_WORD_PAUSED(6)
INFO:WakeWordAgent: IPC Command received:4
INFO:WakeWordAgent: State set to WAKE_WORD_RESUME_REQUESTED(7)
INFO:SensoryWakeWordEngine: handling resume
INFO:SensoryWakeWordEngine: mainLoop thread started
INFO:WakeWordAgent: State set to IDLE(2)
相変わらずWarningは出ていますが、とりあえず動くようにはなりました。
これを使って何をするかが考えどころです。