50
50
50
50
50
50
50
50

The miniDSP UMA-8 microphone array, with onboard direction detection, echo cancellation, and noise reduction, has a wide variety of applications. In this app note we'll run through its use with Google Assistant and a Raspberry Pi.

This app note is based on this article published by Google. You will need to follow that article closely.

google assistant uma8

Why use the UMA-8?[Top]

In Google's hardware setup page, it's suggested that a cheap USB microphone be used. (The Raspberry Pi does not have an inbuilt microphone.) This is not an optimum solution. Instead:

  • The UMA-8 has beam-forming running across the 7 microphones, which improves voice detection.

  • The UMA-8 also has echo cancellation and noise reduction, to reduce the effects of non-voice sounds (like music playing) and noise (traffic, kitchen noises etc).

1. Getting connected[Top]

Connect your Raspberry Pi to a keyboard, mouse, and an HDMI monitor or TV. Plug the UMA-8 into one of the USB ports. (It is powered over USB).

(Google's hardware setup page provides a number of different setup methods, including "headless." For simplicity we suggest starting with a connected monitor, keyboard and mouse. Later on you can try a headless version.)

Install Raspbian onto a micro-SD card and insert it into the Pi. The Google page linked above suggests using NOOBS. We just downloaded Raspbian Stretch with Desktop and burnt it onto an SD card.

Power on the Raspberry Pi. After a short time you should see a desktop appear on your monitor. Click on the Raspbian icon at the top left, select Preferences then Raspberry Pi Configuration. Set your timezone on the Localization tab. You may at this time also wish to enable SSH.

You may like to explore a little further. If you are using a Raspberry Pi 3 with inbuilt Wifi, use the Settings (top right of screen) to join your wireless network. You may also want to change your keyboard layout to U.S., as it defaults to a U.K. layout.

2. Setting up audio[Top]

We connected our Raspberry Pi to the second input of a nanoAVR HD so the audio output from the Pi goes through a home theater system with room EQ. We bet Google Assistant never sounded so good :)

Photograph of UMA-8, Raspberry Pi, and nanoAVR HDA

The instructions on the Google page Configure and Test the Audio aren't quite in the right order. You will need to open a terminal on the Pi to do this. First, list your output audio devices by typing

  alist -l

Here is our output. Note that the HDMI output is card 0 and device 0:

**** List of PLAYBACK Hardware Devices ****
card 0: ALSA [bcm2835 ALSA], device 0: bcm2835 ALSA [bcm2835 ALSA]
  Subdevices: 8/8
  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
  Subdevice #7: subdevice #7
card 0: ALSA [bcm2835 ALSA], device 1: bcm2835 ALSA [bcm2835 IEC958/HDMI]
  Subdevices: 1/1
  Subdevice #0: subdevice #0
card 1: UAC20 [miniDSP micArray XVSM UAC2.0], device 0: USB Audio [USB Audio]
  Subdevices: 1/1
  Subdevice #0: subdevice #0

Now list your input audio devices by typing

  arecord -l

Here is our output. Note that the UMA-8 output is card 1 and device 0:

**** List of CAPTURE Hardware Devices ****
card 1: UAC20 [miniDSP micArray XVSM UAC2.0], device 0: USB Audio [USB Audio]
  Subdevices: 1/1
  Subdevice #0: subdevice #0

Now you will need to edit the file .asoundrc in your home directory /home/pi so that it looks like this (note that the card and device number for pcm.mic and pcm.speaker are as detected by the above commands):

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

To test that the UMA-8 is working, enter this and then speak aloud near the UMA-8:

  arecord --format=S16_LE --duration=5 --rate=16000 --file-type=raw out.raw

To play the file back, enter this:

  aplay --format=S16_LE --rate=16000 out.raw

3. Setting up Google Assistant[Top]

You will now need to Configure a Developer Project and Account Settings. (Follow the instructions on that page. There are a lot of steps, so take your time and make sure you get everything done. Also, you might want to create a separate Google account for this purpose using e.g. a new gmail address.)

Now it's time to install the application. Follow the instructions on the Download the Library and Run the Sample page.

4. Running[Top]

Now you can start the sample application (finally!). In a terminal window, enter

  google-assistant-demo

Then say "Hey Google" followed by a question, like this: "Hey Google, where am I?" or "OK Google, what is my name?".

Wrapping up[Top]

That's it for this app note! Have fun, and please let us know about your UMA-8 and Raspberry Pi with Google Assistant experience in our forum.


Related Products - USB Microphone Arrays