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 sudo rpi-update sudo reboot
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 –
#dtparam=audio=on dtoverlay=pi3-disable-bt dtoverlay=hifiberry-dac
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 –
i2c-dev #snd_bcm2835 snd_usb_audio #DAC Modules snd_soc_bcm2708 bcm2708_dmaengine snd_soc_pcm5102a snd_soc_hifiberry_dac
3. In /home/pi/.asoundrc; I have the following –
pcm.usb { type hw card Device } pcm.external { type hw card sndrpihifiberry } pcm.!default { type hw playback.pcm { type hw slave.pcm "external" } capture.pcm { type plug slave.pcm "usb" } } ctl.!default { type hw playback.pcm { type hw slave.pcm "sndrpihifiberry" } capture.pcm { type plug slave.pcm "usb" } } # The following lines are constantly added at boot. I have no idea which process does # this, but it overrides the configuration above. pcm.!default { type hw card 1 } ctl.!default { type hw card 1 }
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:
audio_output { # type "alsa" type "pulse" name "MPD PulseAudio Output" server "127.0.0.1" }
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-esound-protocol-tcp load-module module-native-protocol-tcp auth-ip-acl=127.0.0.1 #load-module module-zeroconf-publish
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.
pulseaudio -D
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" or 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.