pHAT DAC and airdac challenges

Hi,

I’m having challenges getting the alsa settings correct when trying to play sound out of my pHAT DAC. If I use the one-liner installation line (for just the pHAT DAC, not the airdac), I can play locally stored sounds through the aplay command out of the DAC just fine. The device installs as ALSA Play Source 0, and if I uncomment the line dtparam=audio=on from /boot/config.txt, it becomes ALSA play source 1, but still works with the aplay command. However, when I go to install airdac, or any other streaming program, such as a bluetooth streaming program, I can’t get the sound to come out of the dac. The airplay oneliner install just didn’t work, and I tried on both Raspbian Jessie (Full) and Raspbian Stretch (Lite). What am I doing wrong and how can I adjust my alsa settings to make this all work?
I’m using a Raspberry Pi Zero W.

Could you elaborate what’s not working with the installer and what you see when running “aplay -L” and “aplay -l”?

Ok I’ll try to break down the various options I tried.

I’ve tried a variety of installation options on both Jessie (full) and Stretch (Lite). I would try Jessie Lite if I could find one online, but the Raspberry Pi group only seems to archive full versions of Jessie on their servers.

I’ve tried the following
-1. Start with fresh install of Jessie Full, then install the pHAT DAC using the one line install for the pHAT DAC specifically (not the airdac). This works for playing local files through the aplay command. However this also breaks the bluetooth software I was trying to use because it comments out dtparam=audio=on in /boot/config.txt. When that is commented out, aplay -l returns what I would expect in that there is only one audio sink, numbered 0, and that sink is the pHAT DAC. However, in order to try to get the bluetooth software working, I uncommented dtparam=audio=on. Now, aplay -l returns two options. Sink 0 is now the on board audio sink for the rpi zero (can’t remember it specifically, bcm something or other) and now, instead of sink 0, the pHAT DAC is sink 1. Despite this, aplay will still play local wav files out of the pHAT DAC when it is sink 0 or sink 1 by default. The bluetooth software I was using only supports having one sink, and that sink is by default set to 0. I tried setting the bluetooth software, through alsa’s mixer settings, to work with sink 1, but anything I changed not only did not work, but broke aplay’s ability to play local audio files out of the pHAT DAC. So that was a bust. Next, I tried reordering the sinks to make the pHAT DAC be sink 0 rather than sink 1 by creating a file called alsa.conf in /etc/modprobe.d. This successfully re-ordered the devices, however upon reboot it broke both the output to the pHAT DAC through using aplay to play local files, as well as did not make my bluetooth program work.
-2: I then wanted to try to find a separate software I could use to stream audio to my pi so that I could see if I could get around why this other bluetooth software wasn’t working. In comes airdac. I started with a fresh Debian Stretch Lite install as recommended on the airdac page, and executed the one line installer for airdac, selecting option 2 at the end of the install to also setup the pHAT DAC. This installer did not work at all. It did disable the default audio out, but did not seem to install what the pHAT DAC needed to be working properly. aplay -l returned that no audio sources were connected even though the pHAT DAC was connected.
-3: I repeated everything in step 2 but on a fresh Debian Jessie install instead, again selecting option 2 at the end of the install to setup the pHAT DAC. This also did not work, and aplay -l again returned that no audio sources were connected even though the pHAT DAC was connected.
-4 (I’m about to try this, flashing the sd card now). I’m going to start with a fresh version of Debian Jessie, and first install the pHAT DAC software directly (not the airdac). Then, I will install the airdac software, but instead of selecting option 2, I will select option 0 to avoid any changes to the audio setup. I anticipate that this will prevent some configuration file from being changed by the installer that managed to break the pHAT DAC from working. I will report back with what I find. If this works, it will be a great first start but I ultimately want something that can work without wifi.

Ultimately I would still like to use this other (or any really) bluetooth software rather than airplay. If you have a recommended software that you know works with the pHAT DAC, I’m all ears! Ideally I want software that after it’s initially installed is no additional command line work, and all pairing is done automatically through some sort of daemon. What I was trying to use before was the following:


I’m looking to stream audio from some other device (like a phone or computer) to the pi and then have the pi play the audio out of the pHAT DAC. I’d like it to work on any device without having to install an additional app on my device (the non-pi device, that is).
Hopefully this is some more information for you! Sorry that was very rambly.

Ok quick update after trying the fourth thing on my wall of text. After installing the pHAT DAC, it worked (as I’ve already tried). After running the airdac software and selecting option 0, aplay -l returned that no soundcards were found after the installation. That was quite bizarre because I didn’t think the installer would do anything. Anyways, I went back and checked the /boot/config.txt and noticed that for some reason, the installer deleted a couple lines from this file, and somehow merged the dtoverlay=hifiberry-dac line one line above into a separate line I already added there. Obviously this was breaking everything. Putting an enter in between those two lines, made the pHAT DAC show back up in aplay -l as it had before. aplay now works for local files again, but the raspberry pi won’t show up on my phone at all! Any ideas what is going on here? Does the airdac just not work with Jessie Full? Where should I go from here?

Thanks again for your help!

I think I’m going to try what this other person on github did with a different bluetooth library to get it to work with the Pi Zero W and the pHAT DAC. I’ll let you know how it goes!
https://github.com/BaReinhard/Super-Simple-Raspberry-Pi-Audio-Receiver-Install/issues/36

Ok so the comments in the bug report I linked to in BaReinhard’s Super-Simple-Raspberry-Pi-Audio-Receiver-Install worked!

I’m not sure what’s going on the Pi Zero W that is breaking some of these other softwares that link up to the pHAT DAC. I’m guessing it’s a configuration file or something that manages to break everything.

I believe that without the install script from pimoroni it should would. I as the script is adding some dtoverlays to the /boot/config.txt file along with some USB current settings as well as uncommenting dtparam=audio=on . The installation should be working. I will be taking a look at the bash script that is being curled to see if there is anything else changing that would mess around with sound cards being loaded before others.

What I assume may be causing issues if they are present is that the SSPARI installation is making the default sound card be loaded first so the /etc/asound.conf references card 0, where other programs may be using card X (whatever number they deem necessary).

If you guys have any suggestions feel free to open an issue report and Ill do my best to get things implemented. I have some more free time coming to me until the end of the year so this is what I will be looking into.

Better yet, anyone interested in opening a pull request feel free, ill do some testing and merge when appropriate.

thanks for the interest!