Can't get sound from Drum HAT examples

Hi Phil, I’m Bryn and I’m very new to the PI, I have a PI3 and a Drum Hat, it’s all put together with the latest Raspian and update but I can’t make any noise with it. The Drum hat seems to work in that when I run drum.py it gets as far as trying to initialise the sound but then falls over saying the 3.5mm output isn’t available. I have a working amp plugged into the 3.5mm jack, I’ve checked that alsa-utils are installed but I can’t figure out how to initialise the sound output.

Can you offer any help please.

Bryn

Hi Byrn,

First off, I’ve bumped this into a new thread. Stuff gets a bit lost in the introductions thread otherwise!

Could you post a screenshot of the output you’re seeing? It would be tremendously helpful for diagnosing the problem.

The problem seems to be one of no sound driver being installed by the very latest version of Rasbian. I took a step back to an older verison (on a different sd card) and it works just fine.

I typed aplay -l in the terminal and it showed no entries at all in the latest version, those I expected in the older version. This leads me to my next questions, why have the drivers not been installed and how do I install them now?

Also, I have a Drum Hat and a Phat DAC and looking at the pin-outs they both seem to use pin 40. I suspect this means I can’t use the two together, is this correct?

How do I take a screenshot?

Regards,
Bryn

That’s odd regarding aplay -l, do you have anything in the /boot/config.txt of the newer Raspbian version which could be causing this?

I’m running old and new side-by-side on my desk at the moment, and see the expected outputs from aplay -l, I don’t believe the drivers have been removed, but there are myriad ways to disable them.

You can take screenshots in Raspbian by installing a utility called scrot, but most people just use their smartphone these days, it’s less hassle :D

You could probably get away with not connecting Pin 40 on Drum-HAT. If I remember correctly, I placed the hardware reset mostly to ensure the chip is nudged out of any bad states and a clean slate when the Python library fires up. But it going wonky should be the exception, not the rule.

If you ran the pHAT DAC installer, then you would have deactivated the on-board sound card, that is part of what that script does. Maybe that is why your install had seemingly no driver installed?

I will compare the /boot/config.txt files and see if anything looks funny. I’m still learning here so please bear with me.

I haven’t installed the PHAT DAC yet I mearly noticed the conflict on pin 40. I’ve ordered some 20x2 headers with long pins one of which I’ll fit to the PHAT DAC and I’ll snip off pin 40 to isolate it from the Drum Hat and see what happens.

I havent seen any python example files for the PHAT DAC, have I missed something?

Bryn

The pHAT DAC is just an output for the sound. As long as your system is configured correctly, and it should be after running the installer script, then running the drumhat examples should make use of it.

The continuing saga of enlightenment. I checked config.txt, it was empty so I downloaded the latest image of jessie, installed that and ran the drum hat installation script. It worked just fine on both HDMI and the 3.5mm output. So far so good.

Now for the PHAT DAC. I soldered the header onto PHAT DAC. Not all the pins, pins 2,6,12,35 and 40. I removed the Drum Hat and fitted the PHAT DAC (yes, I did shut down and power off first).

Before running the script I checked config.txt, the last line was dtparam=audio=on

I ran the script, it all seemed to go well. When it was done I rebooted and waited for glorious sound. Nothing. I checked config.txt, now I had

#dtparam=audio=on 
dtoverlay=hifiberry-dac

I ran aplay -l, it showed just the new device. I rebooted again, still nothing. The volume is turned up, honest.

I uncommented the dtparam line, rebooted, I got all the original stuff back as well as the hifiberry stuff when I ran aplay -l and I could get sound from the hdmi and 3.5mm but not the PHAT DAC.

So, where to from here? All help and suggestions will be gratefully received.

Bryn

There should have been a hash before the DTPARAM=AUDIO=ON rather than making it big and bold. Hmmm.

I’m guessing the next thing will be to see a copy of my config.txt. I’ve taken a picture on my phone but how do I add the file to my post?

Ho hum. Quite a learning curve.

I’d recommend soldering physical pins 25, 30 and 34 too since these are the ground pins nearest the return path of the DAC itself. It shouldn’t really matter, but 6 is the opposite end of the board.

What are you running to test the audio output? I recently set up phat-dac on a Pi Zero and needed, in boot/config.txt, only the following:

#dtparam=audio=on
dtoverlay=hifiberry-dac

I’ll try to replicate your setup- there might be a missing piece to the sound setup puzzle that the installer handles that we’re not covering here. Possibly the asound.conf.

Edit: Yup, that seems to be the missing secret sauce. You need to edit /etc/asound.conf and add:

pcm.!default {
  type hw card 0
}
ctl.!default {
  type hw card 0
}

OK, done all that. Still no sound. I’m testing two ways. I installed alsaplayer and “play” a wav file. It goes through the motions but no sound. I also use speaker-test -l5 -c2 -t wav taken from your script. It too goes through the motions but no sound.

I have a Pi Zero, I’ll try that. What version of Raspian were you running?

From your reports I would say both the software and hardware side seems OK… which leaves the point of failure on the output side, does the audio jack connector seem well anchored onto PCB? What are you routing the sound out to, an amp?

A visual check with a magnifier suggests all the solder pads on the 3.5mm socket are OK. I’ll run a soldering iron across them tomorrow when I get a chance just in case. The amp is a powered amp, the same amp I’ve used to check the 3.5mm output on the Pi so I know it works.