I have a Raspberry Pi 3 with a 503HTA Hybrid Tube Amp and a USB Microphone attached. I am running a HiFiBerry preconfigured SD Card image.
My intent is to run a MPD server accessible via tablet app; in this case MPD Control for Android. And also the Amazon Alexa sample application.
The only way I could get this to work was thru PulseAudio. Prior to doing any of this, make sure everything is up-to-date.
sudo apt-get update
sudo apt-get dist-upgrade
I have Raspbian Jessie configured for the Tube Amp with the following modifications:
1. In /boot/config.txt; comment out dtparam=audio=on. This disables the onboard audio. I added the following –
dtoverlay=pi3-disable-bt disables the onboard bluetooth which I believe is necessary for HiFiBerry DACs.
2. In /etc/modules; I have the following lines –
3. In /home/pi/.asoundrc; I have the following –
# The following lines are constantly added at boot. I have no idea which process does
# this, but it overrides the configuration above.
I don’t believe this step is needed when using PulseAudio, however, this .asoundrc config works if you are using a USB microphone and onboard audio out. You can determine the name of your DAC with ‘aplay -l’ from the command line. Replace sndrpihifiberry with ‘ALSA’
4. Installing PulseAudio – My steps:
sudo apt-get install vlc
sudo apt-get install pulseaudio
sudo apt-get install pavucontrol
5. Installing MPD
sudo apt-get install mpd
Modify the /etc/mpd.conf with:
# type "alsa"
name "MPD PulseAudio Output"
You will probably also need to edit this file with your custom options.
6. Modify /etc/pulse/client.conf; uncomment autospawn=yes. Delete the ‘;’ before that line.
7. Modify /etc/pulse/default.pa
### Network access (may be configured with paprefs, so leave this commented
### here if you plan to use paprefs)
load-module module-native-protocol-tcp auth-ip-acl=127.0.0.1
Uncomment the native-protocol entry and add ‘auth-ip-acl=127.0.0.1’ at the end
Some instructions say to uncomment the zeroconf line, but I left it as-is.
8. Depending on which user runs MPD. These commands lets specific users to the PulseAudio groups.
sudo usermod -a -G pulse-access mpd
sudo usermod -a -G pulse mpd
sudo usermod -a -G pulse-access pi
sudo usermod -a -G pulse pi
9. Boot into your Raspbian Desktop GUI. Open a terminal and start PulseAudio.
10. You should now be able to launch the PulseAudio Volume Control.
You should see your DAC as an Output Device and your USB Microphone as an Input Device.
11. Start your Alexa services per the instructions on their GitHub.
Note: The original errors I was getting from the ‘wakeWordAgent -e sensory’ were:
wakeWordAgent: pcm.c:694: snd_pcm_close: assertion 'pcm' failed"
wakeWordAgent: pcm.c:1046: snd_pcm_prepare: Assertion `pcm' failed.
12. Verify your MPD app.
In my experience, you must always start PulseAudio first from a terminal before Alexa or the MPD server will function properly. With these instructions, I was able to have output from MPD and also have Alexa listen and respond.