Skip to content
This repository has been archived by the owner on Dec 20, 2023. It is now read-only.

Audio setup & debugging

René Kliment edited this page Nov 12, 2016 · 42 revisions

Setting up your devices

If you want to change your playback / recording device (also because the default setting doesn't work for you), you can do that in the configuration file. If you installed into /opt as recommended, it is /etc/opt/AlexaPi/config.yaml. If you installed elsewhere, the file config.yaml is in your AlexaPi/src directory.

You may need to adjust the volume and/or input gain for the microphone, you can do this with alsamixer. Once the adjustments have been made, you can save the settings using alsactl store.

Debugging your setup

If there is an error in your log file complaining about alsaaudio you may need to check the name of your sound card input device.

These errors might look like this:

alsaaudio.ALSAAudioError: Device or resource busy [plughw:1]

alsaaudio.ALSAAudioError: No such file or directory [plughw:1]

However, make sure that no other application is using your sound card and that your playback / recording works with other applications.

  1. To test playback, run aplay /usr/share/sounds/alsa/Front_Center.wav
  2. To rest recording, run arecord -D yourdevice test.wav - exit with CTRL+C and aplay test.wav

Selecting the device default for input and / or output often works.

You can use these commands to figure out your device names (look for the "plughw:" line):

arecord -l
arecord -L
aplay -l
aplay -L

Audio debugging script

To help in debugging and tracking down audio issues, please use the following command as a standard form of data collection:

cd ~ && wget https://raw.githubusercontent.com/alexa-pi/AlexaPi-misc/master/alsa-info.sh && bash alsa-info.sh

This site has some good information regarding alsa: http://www.volkerschatz.com/noise/alsa.html

If you can't figure it out yourself, be sure to post the output of those commands when asking for help

Raspberry Pi-specific

HDMI Audio

If you are using HDMI out and are losing the first part of audio playback try running vcgencmd force_audio hdmi 1. See the Raspberry Pi section in Devices for details.

Arch Linux

The internal audio is not enabled by default in Arch Linux see the Raspberry Pi/Audio section in Arch wiki on how to do that manually.

Pulseaudio

Right now it might not work. We're discussing this in #38. You can find some tips in there for the time being. Any help on that is also appreciated.

Disabling PA

All under root:

mkdir -p /var/lib/AlexaPi/.config/pulse
chown -R alexapi:alexapi /var/lib/AlexaPi/
usermod --home /var/lib/AlexaPi alexapi
cp /etc/pulse/client.conf /var/lib/AlexaPi/.config/pulse/
# edit /var/lib/AlexaPi/.config/pulse/client.conf and set "autospawn = no"

System mode

This is the preferred (and possibly the only sensible) way to run PA with AlexaPi.

TODO How-To.

User session mode (AlexaPi as the only audio app)