1
3

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 5 years have passed since last update.

Raspberry PiでAlexa

Last updated at Posted at 2018-09-11

RaspberryPi3modelBを購入したので前々から興味のあったAlexaを実装しよう
Alexaといえば去年あたりに声優スキルが実装されていたはずです。
早くレオナルド・ダ・ヴィンチ(cv:津田健次郎氏)の声に溺れたい:laughing:
ということで早速準備にとりかかりましょう!!!

用意するもの

 - Raspberry Pi 3 modelB
 - SDカード(OSインストール済み)
 - キーボード
 - モニター
 - マウス
 - スピーカー 
 - マイク
 - コード類

Alexa実装の手順

  1. 音声デバイス(マイク、スピーカー)のセットアップ
  2. Amazon開発者アカウントに登録
  3. Alexa Voice Service をダウンロード
  4. Alexaを起動

1.音声デバイス(マイク、スピーカー)のセットアップ

今回利用したものは、

スピーカー:エレコム スピーカー USB給電 4W コンパクト ブラック MS-P08UBK

マイク :BU-Bauty いつでもどこへも携帯可能!世界最小USBマイク PC Mac用USBマイク 超小型 超ミニ 22mmx18mmx5mm

https://www.amazon.co.jp/Buauty-BU-11-%E3%81%84%E3%81%A4%E3%81%A7%E3%82%82%E3%81%A9%E3%81%93%E3%81%B8%E3%82%82%E6%90%BA%E5%B8%AF%E5%8F%AF%E8%83%BD%EF%BC%81%E4%B8%96%E7%95%8C%E6%9C%80%E5%B0%8FUSB%E3%83%9E%E3%82%A4%E3%82%AF-PC-Mac%E7%94%A8USB%E3%83%9E%E3%82%A4%E3%82%AF-%E8%B6%85%E5%B0%8F%E5%9E%8B-%E8%B6%85%E3%83%9F%E3%83%8B-22mmx18mmx5mm/dp/B01KZPF1U8)

これらをRaspberryPiに接続する。
接続できているか確認する

pi@raspberrypi:~ $ lsusb

接続ができているのにスピーカーが動かない場合はこちら

2.Amazon開発者アカウントに登録

[失敗しないAlexa開発者アカウントの作り方]
https://dev.classmethod.jp/voice-assistant/how-to-safety-create-alexa-developers-account/

を参考にさせてもらいました。

3.Alexa Voice Service をダウンロード

Alexa Voice Service のサンプルプログラムをダウンロード

$ cd Desktop
$ git clone https://github.com/alexa/alexa-avs-sample-app.git

 ダウンロードした中にある automated_install.sh を エディタで開き、ProductID、ClientID、ClientSecret の項目にそれぞれ取得した値をセット。

$ cd Desktop/alexa-avs-sample
$ sudo vi automated_install.sh
# This is the name given to your device or mobile app in the Amazon developer portal. To look this up, navigate to https://developer.amazon.com/edw/home.html. It may be labeled Device Type ID.
ProductID=[取得したProductID]
# Retrieve your client ID from the web settings tab within the developer console: https://developer.amazon.com/edw/home.html
ClientID=[取得したClientID]
# Retrieve your client secret from the web settings tab within the developer console: https://developer.amazon.com/edw/home.html
ClientSecret=[取得したClientSecret]

インストールプログラムを実行させる

$ cd ~/Desktop/alexa-avs-sample-app
$ . automated_install.sh

4.Alexaを起動

terminalを3つ用意する
次の順で起動させる

Terminal1

cd ~/Desktop/alexa-avs-sample-app/samples
cd companionService && npm start

Terminal2

cd ~/Desktop/alexa-avs-sample-app/samples
cd javaclient && mvn exec:exec

Terminal3

cd ~/Desktop/alexa-avs-sample-app/samples
cd wakeWordAgent/src && ./wakeWordAgent -e sensory

これで動くはず!
「Alexa!」 --- PON!
「レオナルドの時間を聞いて」  ---「レオナルドの時間を開きます  --- レオナルド登場!!!」

[参考]
https://github.com/alexa/alexa-avs-sample-app/wiki/

1
3
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
1
3

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?