Volume control independent from the system (alsamixer)


Is there anyway to control the volume of the rhasspy by software instead of getting the volume level from alsamixer?
I wanted to have this independently because I have other sound components running on the same raspberry pi each with its own volume settings and I want to leave the alsamixer on the top volume.
But since I cannot control the volume level on rhasspy it is just too loud.

Current audio components on the rpi:

  • shairport-sync which uses the asound/alsamixer direct volume level but controllable on the physical volume button on iOS devices
  • mopidy which has a “wrapper” in which I can set a different volume level than the asound/alsamixer volume level (up to its maximum)
  • rhasspy which uses the asound/alsamixer direct volume level. It is here that I would like to have something similar to mopidy where I could set a lower volume than the one defined on the sound/alsamixer direct volume level.


Haven’t done it but presuming you could use a softvol.

https://alsa.opensrc.org/Softvol for a specific pcm maybe


Thanks for the tip!

I was able to create the new softvol device (named rhasspysnd as you can see below) and mixer but Rhasspy doesn’t see that device:

pi@livingroom:~ $ aplay -L
Discard all samples (playback) or generate zero samples (capture)
JACK Audio Connection Kit
PulseAudio Sound Server
bcm2835 Headphones, bcm2835 Headphones
Default Audio Device
bcm2835 Headphones, bcm2835 Headphones
Direct sample mixing device
bcm2835 Headphones, bcm2835 Headphones
Direct sample snooping device
bcm2835 Headphones, bcm2835 Headphones
Direct hardware device without any conversions
bcm2835 Headphones, bcm2835 Headphones
Hardware device with all software conversions
bcm2835 Headphones
USB Stream Output
USB Stream Output

And on Rhasspy:

If I try to use it through aplay on the rpi it works ok:
aplay --device rhasspysnd a.wav

Maybe Rhasspy isn’t loading the softvol type cards right? Can we make it load those?

Dunno but softvols can be really confusing as they don’t exist until after you play that pcm chain.
I am not sure on the setup as haven’t done much with them but presumed you could have a pcm chain with the softvol in it for rhasspy that just has the initial alsa device as a slave.

I think on boot in the start-up script you need to aplay the pcm with the softvol once and then it should be there from then aplay -d for duration is it just have a second burst of some wav before rhasspy loads.

Also with asla pcms you have to add the description tag to that pcm. Have a look through the forum as there is an example somewhere.

Think its hint.description

hint.description "Mic1 loopback 0,1,0"

or this format in the ever confusing alsa formatting

hint {
                description "Mic2 loopback 0,1,1"

As sometimes without they don’t list for some reason without, just change the description to what you need.

Sorry I missed posting my config. Making the change you mentioned still doesn’t work:

pi@livingroom:~ $ cat ~/.asoundrc
pcm.rhasspysnd {
type softvol
slave.pcm “sysdefault”
control.name “rhasspysndctrl”
control.card 0
hint.description “Rhasspy”

It already shows the description:
pi@livingroom:~ $ aplay -L

But on the rhasspy interface it still isn’t available. (I have already added an aplay command to my rpi /etc/profile so that on boot it runs it):
pi@livingroom:~ $ cat /etc/profile
aplay --device rhasspysnd output.wav

I always refer to this article when fiddling with alsa.

The softvol is a control so like the article create an end PCM where the chain continues and the softvol is a slave.

Otherwise dunno but maybe someone else will post as remember something mentioned in the forum about PCMs needing a description or tag line to turn up in Rhasspy and just plain forget what and where.

Finally solved. Was missing passing the -v “/etc/asound.conf:/etc/asound.conf” on the docker run