Volume for Pirate Audio: Headphone Amp for Raspberry Pi

For the “Pirate Audio: Headphone Amp for Raspberry Pi”, how do you control volume from the command line or from mpd?

E.g., alsa mixer gives “This device has no controls”. There are various threads online with people trying to fix this, but no fixes I could follow.

The device works:

> aplay -l
**** List of PLAYBACK Hardware Devices ****
card 0: sndrpihifiberry [snd_rpi_hifiberry_dac], device 0: HifiBerry DAC HiFi pcm5102a-hifi-0 [HifiBerry DAC HiFi pcm5102a-hifi-0]
  Subdevices: 1/1
  Subdevice #0: subdevice #0

But e.g.,

> sudo pactl list sinks
Connection failure: Connection refused
pa_context_connect() failed: Connection refused

For example,

mpc status

shows that the volume is not available for setting.

Any ideas?

Would love some input on this if anybody has any ideas!

Hi Björn (me again):

try this asound.conf:

pcm.!default  {
 type hw card 0
}
ctl.!default {
 type hw card 0
}
pcm.!default {
        type plug
        slave.pcm “softvol”
}
pcm.softvol {
        type softvol
        slave {
                pcm “dmix”
        }
        control {
                name “Amp”
                card 0
        }
        min_dB -5.0
        max_dB 20.0
        resolution 6
}

And skip pulse-audio (the pa-stuff). This is pure alsa-level (like aplay). This configuration creates a mixer device.

Hi - thank you, I will try this and report back!

Many thanks @bablokb - this worked!

Instructions written up here:

Pull request here: Added 'build your own' directory with help for getting started using the device without other software by bjohas · Pull Request #90 · pimoroni/pirate-audio · GitHub

Sorry for reopening and old thread, but this does not solve the problem (any more). I’ve tried this both in bookworm and bullseye on a RPI Zero 2, to no avail.

Well it probably still does - it actually states that you need to stick with pure alsa and skip everything else. In the past this was pulse-audio, now it is pipewire. So you will have to think about if you are adventurous enough to remove all packages not related to alsa and set up your sound system the hard way.

I did, and by downgrading to bullseye I made sure there’s no pulse audio or pipewire present (I also checked by listing the system services), there’s only alsa.
I narrowed down the problem a bit in the meantime. The system’s complaining that the softvol alsa mod isn’t installed. The libasound_module_ctl_softvol.so isn’t present.
I’ll update this once I found a solution.

1 Like