Skip to content

Instantly share code, notes, and snippets.

@jlpdiez
Last active July 23, 2020 11:39
Show Gist options
  • Save jlpdiez/2850f1d9e9d74500ab672fe9a22d5c9d to your computer and use it in GitHub Desktop.
Save jlpdiez/2850f1d9e9d74500ab672fe9a22d5c9d to your computer and use it in GitHub Desktop.
Installing Snips with ReSpeaker Mic Array v2.0 / ReSpeaker 2-Mics Pi HAT

Snips on Raspi 3B+

Snips

Install raspbian stretch lite

Config stuff like wifi, ssh...

Installing Audio

Respeaker Mic Array v2.0

RespeakerCore image

Mic array is automatically detected and drivers are loaded. You just need to plug it in.

ReSpeaker 2-Mics Pi HAT

PiHAT image

sudo apt update && sudo apt install git
git clone https://github.com/respeaker/seeed-voicecard.git
cd seeed-voicecard
sudo ./install.sh
sudo reboot

See SeeedStudio Wiki for more info on how to setup LED's & button.

Theres a useful snips skill to make use of ReSpeaker LED's here

Easy way - Remote install, management and config

This setup method is done from another computer to where Snips will live.

  1. Install NodeJS:
curl -sL https://deb.nodesource.com/setup_11.x | sudo -E bash -
sudo apt install -y nodejs
  1. Install SAM
sudo npm install -g snips-sam

To list devices:

sam devices

No device was found on tests but connection did work. Probably it's an issue with router as raspi is cabled and PC is on wifi.

To connect:

sam connect raspberrypi.local

You are now linked to the snips device. To see status:

sam status

To install snips easymode

sam init

Setup audio

sam setup audio

Test speaker

sam test speaker

Test microphone

sam test microphone

Install demo:

sam install demo

Setting up an Assistant

Go to Snip's console register and do your stuff

Login

sam login

Install an assistant

sam install assistant

See what's happening

sam watch

Manual Install Snips

This install method is done after this link

Please see this other section for another installation method using sam.

sudo apt-get update
sudo apt-get install -y dirmngr
sudo bash -c  'echo "deb https://raspbian.snips.ai/$(lsb_release -cs) stable main" > /etc/apt/sources.list.d/snips.list'
sudo apt-key adv --keyserver pgp.mit.edu --recv-keys D4F50CDCA10A2849

sudo apt-get update
sudo apt-get install -y snips-platform-voice

Config audio

To list playback devices:

aplay -l

**** List of PLAYBACK Hardware Devices ****
card 0: ALSA [bcm2835 ALSA], device 0: bcm2835 ALSA [bcm2835 ALSA]
  Subdevices: 7/7
  Subdevice #0: subdevice #0
  Subdevice #1: subdevice #1
  Subdevice #2: subdevice #2
  Subdevice #3: subdevice #3
  Subdevice #4: subdevice #4
  Subdevice #5: subdevice #5
  Subdevice #6: subdevice #6
card 0: ALSA [bcm2835 ALSA], device 1: bcm2835 ALSA [bcm2835 IEC958/HDMI]
  Subdevices: 1/1
  Subdevice #0: subdevice #0
card 1: ArrayUAC10 [ReSpeaker 4 Mic Array (UAC1.0)], device 0: USB Audio [USB Audio]
  Subdevices: 1/1
  Subdevice #0: subdevice #0

Playback is card 1 / device 0 (hw:1,0)

To list microphones:

arecord -l

**** List of CAPTURE Hardware Devices ****
card 1: ArrayUAC10 [ReSpeaker 4 Mic Array (UAC1.0)], device 0: USB Audio [USB Audio]
  Subdevices: 0/1
  Subdevice #0: subdevice #0

Capture is card 1 / device 0 (hw:1,0)

Select audio I/O

sudo nano /etc/asound.conf

pcm.!default {
  type asym
   playback.pcm {
     type plug
     slave.pcm "hw:1,0"
   }
   capture.pcm {
     type plug
     slave.pcm "hw:1,0"
   }
}

Adjust volume

alsamixer

F6 to select card and F4 to change gain

Seems like Mic Array v2.0 does not show up here

To test if everything works

arecord -f cd -Dhw:1 | aplay -Dhw:1

Demo assistant

sudo apt-get install snips-platform-demo

After this step the system should recognize "Hey Snips" and play some sounds.

Monitoring

Snips config file:

sudo nano /etc/snips.toml

To monitor what snips is doing

sudo apt-get install snips-watch
snips-watch [-v -vv -vvv]

Custom wakeword

https://snips.gitbook.io/documentation/advanced-configuration/wakeword/personal-wakeword

Snips satellite

  1. Install repos. Guide from here
sudo apt-get update
sudo apt-get install -y dirmngr
sudo bash -c 'echo "deb https://raspbian.snips.ai/$(lsb_release -cs) stable main" > /etc/apt/sources.list.d/snips.list'
# As of time of writing Buster is yet not supported so the command should be
sudo bash -c 'echo "deb https://raspbian.snips.ai/stretch stable main" > /etc/apt/sources.list.d/snips.list'
sudo apt-key adv --fetch-keys  https://raspbian.snips.ai/531DD1A7B702B14D.pub
sudo apt-get update
  1. Install needed packages taken from here
sudo apt install snips-hotword-model-heysnipsv4
sudo apt install snips-satellite
# To use skills intall this too
sudo apt install snips-skill-server
  1. Time to configure satellite
sudo nano /etc/snips.toml

Uncomment and edit

[snips-common]
mqtt = "<your-base-hostname>:1883"
[snips-audio-server]
bind = "<YOUR_SITE_ID>@mqtt"

Save and restart

sudo systemctl restart snips-satellite
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment