respeaker / respeakerd

respeakerd is the server application for the microphone array solutions of SEEED, based on librespeaker which combines the audio front-end processing algorithms.
MIT License
54 stars 24 forks source link

respeakerd

respeakerd is the server application for the microphone array solutions of SEEED, based on librespeaker which combines the audio front-end processing algorithms.

1. Installation

1.1 Prerequisites

(1) ReSpeaker Core v2

The system running on ReSpeaker v2 should be upgraded to version 20180107 or later, as from that version on, many fixes for PulseAudio configuration has been applied.

OneDrive download link:

You can backup your workspace to the onboard eMMC. If your onboard eMMC isn't formated, format it via fdisk and mount it.

(2) Raspberry Pi

NOTE: The support for Pi is still under development.

raspbian stretch is recommended. You need to install the driver for ReSpeaker Pi Hats, please refer here.

Now we support the following Pi Hats:

Secondly you need to add the apt repository of Seeed.

$ echo "deb https://seeed-studio.github.io/pi_repo/ stretch main" | sudo tee /etc/apt/sources.list.d/seeed.list
$ curl https://seeed-studio.github.io/pi_repo/public.key | sudo apt-key add -
$ sudo apt update

After the first time you installted the Hat's driver, please do the following configuration.

$ sudo apt install respeakerd-pi-tools
$ sudo respeakerd-pi-tools setup-pulse

Reboot the Pi to apply the configurations ( for PulseAudio ) before you move to the next step.

1.2 Installation

ssh to the board, then execute

curl https://raw.githubusercontent.com/respeaker/respeakerd/master/scripts/install_all.sh|bash

This script will install all the dependencies, and write the microphone array type in /etc/respeaker/respeakerd.conf as your selection. The Alexa authorization is needed by the Python client of respeakerd.

2. Run

2.1 Run respeakerd

In the above step 1.2, a systemd service respeakerd will be installed and started. If everything's right, the respeakerd should be running now. You can inspect the status of the respeakerd service with

sudo journalctl -f -u respeakerd

2.2 Run clients

We have implemented a Python client for respeakerd, this client is also an AVS client. Since all the Python dependencies are already installed by the script in step 1.2, you can simply run the client with

python ~/respeakerd/clients/Python/demo_respeaker_v2_vep_alexa_with_light.py

And speak snowboy to trigger the conversation with Alexa.

We have also modified the official AVS Device SDK (C++) to work with respeakerd - https://github.com/respeaker/avs-device-sdk. We will have a separated guide on this.

3. Troubleshooting Tips

3.1 Under the hood

The following image shows the software stack, and the audio flow. Understanding this will be helpfull to your debugging.

3.2 ASLA configurations

(a) If you ever touched /etc/asound.conf and did some mofidications there, you're recommended to restore this file to its default.

For ReSpeaker Core v2, there's no /etc/asound.conf by default.

For Raspberry Pi, the seeed-voicecard installation script will install a systemd service which restores /etc/asound.conf to its default every boot up. Please make sure you've not disabled the seeed-voicecard service.

$ sudo systemctl list-unit-files | grep seeed
seeed-voicecard.service                enabled

(b) Check the volume settings for the playback and cpature devices

For ReSpeaker Core v2, if you want to restore the ALSA volume to its default, do as the following

$ sudo alsamixer

Tune it like this

Then save the configuration permanetly.

$ sudo alsactl store

For Raspberry Pi, the same thing as /etc/asound.conf will happen. The seeed-voicecard service will restore the mixer configuration every boot, with the configuration file at the following path as the original.

Please note that, if you want to change our default volume configuration, any alsamixer alsactl operation will be overwritten when the system boots up next time. You need to do as the following.

Tune the volume with alsamixer -> Save the mixer configuration to state file via alsactl store -> cp /var/lib/alsa/asound.state /etc/voicecard/ac108_asound.state if you're using ReSpeaker 4 Mic Array for Raspberry Pi, cp /var/lib/alsa/asound.state /etc/voicecard/ac108_6mic.state if you're using ReSpeaker Linear 4 Mic Array for Raspberry Pi, ReSpeaker 6 Mic Array for Raspberry Pi, and then reboot the Pi.

3.3 PulseAudio configuration

respeakerd depends on PulseAudio system. For ReSpeaker Core v2, PulseAudio is included by default in the system image. For Raspberry Pi, PulseAudio will be installed as a dependence of respeakerd when you install respeakerd with apt-get. PulseAudio will detect the microhpne array codec with the udev mechanism. So if you ever touched the configuration of PulseAudio and disabled the module-udev-detect module, please remember to enable it. You can check if udev is enabled in your PulseAudio configuration with

$ pactl list modules|grep -n3 udev

If you can find the following text in the output, udev is enabled.

44-Module #5
45:     Name: module-udev-detect
46-     Argument:
47-     Usage counter: n/a
48-     Properties:

If you run

$ pactl list sources

You will be able to find a source with name

Other resources