{"id":495,"date":"2016-10-22T12:50:32","date_gmt":"2016-10-22T16:50:32","guid":{"rendered":"http:\/\/markwheeler.com\/wordpress\/?p=495"},"modified":"2016-10-22T12:50:32","modified_gmt":"2016-10-22T16:50:32","slug":"raspberry-pi3-503hta-tube-dac-and-usb-microphone","status":"publish","type":"post","link":"https:\/\/markwheeler.com\/?p=495","title":{"rendered":"Raspberry PI3, 503HTA Tube DAC and USB Microphone."},"content":{"rendered":"<p>I have a <a href=\"http:\/\/amzn.to\/2eaAGoF\" target=\"_blank\" rel=\"noopener\">Raspberry Pi 3<\/a> with a <a href=\"http:\/\/www.pi2design.com\/store\/p13\/503HTA_-_Hybrid_Tube_Amp.html\" target=\"_blank\" rel=\"noopener\">503HTA Hybrid Tube Amp<\/a> and a <a href=\"http:\/\/amzn.to\/2dY5U0v\" target=\"_blank\" rel=\"noopener\">USB Microphone<\/a> attached. I am running a <a href=\"https:\/\/www.hifiberry.com\/guides\/sd-card-images\/\" target=\"_blank\" rel=\"noopener\">HiFiBerry preconfigured SD Card<\/a> image.<\/p>\n<p>My intent is to run a MPD server accessible via tablet app; in this case <a href=\"https:\/\/play.google.com\/store\/apps\/details?id=org.chatminou.mpdcontrol&#038;hl=en\" target=\"_blank\" rel=\"noopener\">MPD Control<\/a> for Android. And also the <a href=\"https:\/\/github.com\/alexa\/alexa-avs-sample-app\/wiki\/Raspberry-Pi\" target=\"_blank\" rel=\"noopener\">Amazon Alexa<\/a> sample application.<\/p>\n<p>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.<\/p>\n<pre>\nsudo apt-get update\nsudo apt-get dist-upgrade\nsudo rpi-update\nsudo reboot\n<\/pre>\n<p>I have Raspbian Jessie configured for the Tube Amp with the following modifications:<br \/>\n<strong>1. In \/boot\/config.txt; comment out dtparam=audio=on. This disables the onboard audio. I added the following &#8211;<\/strong><\/p>\n<pre>\n#dtparam=audio=on\ndtoverlay=pi3-disable-bt\ndtoverlay=hifiberry-dac\n<\/pre>\n<p>dtoverlay=pi3-disable-bt disables the onboard bluetooth which I believe is necessary for HiFiBerry DACs.<\/p>\n<p><strong>2. In \/etc\/modules; I have the following lines &#8211;<\/strong><\/p>\n<pre>\ni2c-dev\n#snd_bcm2835\nsnd_usb_audio\n#DAC Modules\nsnd_soc_bcm2708\nbcm2708_dmaengine\nsnd_soc_pcm5102a\nsnd_soc_hifiberry_dac\n<\/pre>\n<p><strong>3. In \/home\/pi\/.asoundrc; I have the following &#8211;<\/strong><\/p>\n<pre>\npcm.usb\n{\n    type hw\n    card Device\n}\npcm.external\n{\n    type hw\n    card sndrpihifiberry\n}\npcm.!default\n{\n    type hw\n    playback.pcm\n    {\n        type hw\n        slave.pcm \"external\"\n    }\n    capture.pcm\n    {\n        type plug\n        slave.pcm \"usb\"\n    }\n}\nctl.!default\n{\n    type hw\n    playback.pcm\n    {\n        type hw\n        slave.pcm \"sndrpihifiberry\"\n    }\n    capture.pcm\n    {\n        type plug\n        slave.pcm \"usb\"\n    }\n}\n# The following lines are constantly added at boot. I have no idea which process does\n# this, but it overrides the configuration above.\npcm.!default {\n\ttype hw\n\tcard 1\n}\n\nctl.!default {\n\ttype hw\n\tcard 1\n}\n<\/pre>\n<p>I don&#8217;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 &#8216;aplay -l&#8217; from the command line. Replace sndrpihifiberry with &#8216;ALSA&#8217;<\/p>\n<p><strong>4. Installing PulseAudio &#8211; My steps:<\/strong><\/p>\n<pre>\nsudo apt-get install vlc\nsudo apt-get install pulseaudio\nsudo apt-get install pavucontrol\n<\/pre>\n<p><strong>5. Installing MPD<\/strong><\/p>\n<pre>\nsudo apt-get install mpd\n<\/pre>\n<p>Modify the \/etc\/mpd.conf with:<\/p>\n<pre>\naudio_output {\n#       type            \"alsa\"\n        type            \"pulse\"\n        name            \"MPD PulseAudio Output\"\n        server          \"127.0.0.1\"\n}\n<\/pre>\n<p>You will probably also need to edit this file with your custom options. <\/p>\n<p><strong>6. Modify \/etc\/pulse\/client.conf; uncomment autospawn=yes. Delete the &#8216;;&#8217; before that line.<\/strong><\/p>\n<p><strong>7. Modify \/etc\/pulse\/default.pa<\/strong><\/p>\n<pre>\n### Network access (may be configured with paprefs, so leave this commented\n### here if you plan to use paprefs)\n#load-module module-esound-protocol-tcp\nload-module module-native-protocol-tcp auth-ip-acl=127.0.0.1\n#load-module module-zeroconf-publish\n<\/pre>\n<p>Uncomment the native-protocol entry and add &#8216;auth-ip-acl=127.0.0.1&#8217; at the end<br \/>\nSome instructions say to uncomment the zeroconf line, but I left it as-is.<\/p>\n<p><strong>8. Depending on which user runs MPD. These commands lets specific users to the PulseAudio groups.<\/strong><\/p>\n<pre>\nsudo usermod -a -G pulse-access mpd\nsudo usermod -a -G pulse mpd\nsudo usermod -a -G pulse-access pi\nsudo usermod -a -G pulse pi\n<\/pre>\n<p><strong>9. Boot into your Raspbian Desktop GUI. Open a terminal and start PulseAudio.<\/strong><\/p>\n<pre>\npulseaudio -D\n<\/pre>\n<p><strong>10. You should now be able to launch the PulseAudio Volume Control.<\/strong><br \/>\n<a href=\"http:\/\/54.159.73.21\/wp-content\/uploads\/2016\/10\/pac.png\"><img loading=\"lazy\" decoding=\"async\" src=\"http:\/\/markwheeler.com\/wordpress\/wp-content\/uploads\/2016\/10\/pac-300x135.png\" alt=\"pac\" width=\"300\" height=\"135\" class=\"alignnone size-medium wp-image-496\" srcset=\"https:\/\/markwheeler.com\/wp-content\/uploads\/2016\/10\/pac-300x135.png 300w, https:\/\/markwheeler.com\/wp-content\/uploads\/2016\/10\/pac-1024x462.png 1024w, https:\/\/markwheeler.com\/wp-content\/uploads\/2016\/10\/pac-768x347.png 768w, https:\/\/markwheeler.com\/wp-content\/uploads\/2016\/10\/pac-1536x693.png 1536w, https:\/\/markwheeler.com\/wp-content\/uploads\/2016\/10\/pac.png 1597w\" sizes=\"auto, (max-width: 300px) 100vw, 300px\" \/><\/a><br clear=\"all\"><br \/>\nYou should see your DAC as an Output Device and your USB Microphone as an Input Device.<\/p>\n<p><strong>11. Start your Alexa services per the instructions on their GitHub.<\/strong><br \/>\nNote: The original errors I was getting from the &#8216;wakeWordAgent -e sensory&#8217; were:<\/p>\n<pre>\nwakeWordAgent: pcm.c:694: snd_pcm_close: assertion 'pcm' failed\"\nor\nwakeWordAgent: pcm.c:1046: snd_pcm_prepare: Assertion `pcm' failed.\n<\/pre>\n<p><strong>12. Verify your MPD app.<\/strong><\/p>\n<p>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.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>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 [&hellip;]<\/p>\n","protected":false},"author":3,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"_monsterinsights_skip_tracking":false,"footnotes":""},"categories":[6,8,9],"tags":[22,53,57,87],"class_list":["post-495","post","type-post","status-publish","format-standard","hentry","category-music","category-projects","category-raspberry-pi","tag-alexa","tag-hifiberry","tag-hybrid-tube-amp","tag-raspberry-pi"],"jetpack_featured_media_url":"","_links":{"self":[{"href":"https:\/\/markwheeler.com\/index.php?rest_route=\/wp\/v2\/posts\/495","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/markwheeler.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/markwheeler.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/markwheeler.com\/index.php?rest_route=\/wp\/v2\/users\/3"}],"replies":[{"embeddable":true,"href":"https:\/\/markwheeler.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=495"}],"version-history":[{"count":0,"href":"https:\/\/markwheeler.com\/index.php?rest_route=\/wp\/v2\/posts\/495\/revisions"}],"wp:attachment":[{"href":"https:\/\/markwheeler.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=495"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/markwheeler.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=495"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/markwheeler.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=495"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}