Pirate Audio Clock

I have a Raspberry Pi Zero W with a Pirate Audio (with the mini speaker) HAT attached. I’m trying to make a silly little clock. All my work is being done in Python 3.

I’ve figured out how to display a picture on the LCD display and how to get the current time superimposed over it. I can also read the buttons and call functions when they’re pressed.

What I can’t figure out is how to send any audio to the speaker. I want to make the clock chime at 0, 15, 30 and 45. Being able to control the volume would be great also.

Does anyone have any info or examples of how to send audio to the speaker on this board?

Thanks!

To make the pirate Audio the default audio device you need to edit the config.txt file.
sudo nano /boot/config.txt
and add the following two lines.
dtoverlay=hifiberry-dac
gpio=25=op,dh
After that it goes something like this.

I had

dtoverlay=hifiberry-dac
gpio=25=op,dh

in my config.txt already. I just tried changing

dtparam=audio=on

To

dtparam=audio=off

and rebooting. That seemed to have fixed the issue. Thanks for your help!

That’s good to hear. I’ll have to go look up what dtparam=audio=off does. I believe turns off the built in sound chip?