balenablock-audio WM8960 DAC HAT

I have a problem with the integration of the WM8960 DAC HAT module with balenaOs. I use balena-blocks audio to be able to make sound on the machine. The audio managed to find my audio card but I can’t manage to use the card to make sound.

According to the documentation: GitHub - balenablocks/audio: Audio building block for balenaOS, based on pulseaudio. I need to use the AUDIO_OUTPUT variable to set the sound card.
So I did this:

This doesn’t work my balenablock-audio can’t use my sound card I don’t know why. Can you enlighten me step by step how I can use my WM8960 DAC HAT module with balenaOS.
Here is my error returned by balenablocks-audio

Best Regards

Hi @firat,

I see from their documentation that there are drivers required for this HAT [1]. Have you installed them by chance?

If not, you can test them using our Kernel Module Build [2] to ensure it’s working as expected, and then if so, you can submit a Pull Request to our Raspberry Pi repo [3] on GitHub so that we can include those going forward in future iterations of the hostOS.

Let us know how things go and if you have any trouble testing the drivers or getting them added!

[1] WM8960 Audio HAT - Waveshare Wiki
[2] GitHub - balena-os/kernel-module-build: Example project for building an OOT kernel module in balena
[3] GitHub - balena-os/balena-raspberrypi: Balena support for RaspberryPI boards

Hi @the-real-kenna,

Thank you for your answer, however I can’t install the driver on balena, it complains that I’m not on raspbian :confused:
That said, in the resin boot overlay folder of my sd card, I already have the file wm8960-soundcard.dtbo
I absolutely don’t know how to use the kernel modules repository, do you have more documentation?
When I do an aplay -l in the audio container, I can see my sound card (card 1)

the AUDIO OUTPUT environment variable to the value

But I cannot use it

In my device configuration, I add this.

Best Regards.


I forgot to say, if I try to play a wav file with the audio container, I get this:

Obviously no sound comes out of my audio card, it would have been too good haha

Best Regards.

Hi, just reading through this thread.

The WM8960 codec is already supported on the Linux kernel that BalenaOS is using. The only missing pieces that are provided by the manufacturer are the asound.conf and asound.state files.

Could you try to copy them into the host OS and verify the playback and recording?

To copy them, log into the hostOS and type the following:

mount -o remount,rw /

And then, from your workstation clone the project and copy the files to the device:

cd /tmp
git clone
scp -P 22222 /tmp/WM8960-Audio-HAT/asound.conf root@<ip address>:/etc/asound.conf
scp -P 22222 /tmp/WM8960-Audio-HAT/wm8960_asound.state root@<ip address>:/var/lib/alsa/asound.state

If scp is not working for you (depends on your client version), you can try using rsync.

Once that is done, reboot the device, and try to play and record with:

aplay -l
arecord -l

Hi @alexgg

Thanks for your reply, but I can’t run this.
I use a microservice architecture, connected through a compose docker. Among it’s microservices, there is a textopeech which generates wav files and uses the audio container for the sound to work.

To be a little clearer, in my docker-compose , about the audio, I have:

    restart: always
    image: balenablocks/audio:raspberrypi4-64
    privileged: true
      io.balena.features.dbus: 1
      - src:/src
      - audio

    restart: always
    image: smartlockers/app:texttospeech-x.x.x.x.x.x
    privileged: true
      PULSE_SERVER: audio:4317
      - src:/src
      - audio
      - default
      - texttospeech
    driver: bridge
    driver: bridge
    driver: bridge
    driver: bridge

By the way, I also changed the configuration of my device. As I can’t use the AUDIO OUTPUT variable with my sound card I did this:

Hello, I’m happy to report that I managed to get the sound card: WM8960 Audio HAT - Waveshare Wiki to work with balena. Here is the solution GitHub - MiroYld/smartaudio-docker: Play sound in your docker container. Do not hesitate to use this git repository if you have a problem with the WM8960


Glad to know that it worked and thanks for sharing the example app. We will use it as a reference.