Default sound volume for all ALSA devices

alsaaudioconfiguration

I woud like to set up the default sound volume once for all, for all ALSA devices that will be connected ever.

Of course, I could do amixer ... or even alsamixer to modify the volume of currently available soundcards.
But I really want to modify the default volume even for future soundcards that will be added later.

In which config file should I set this default sound volume?

I've seen /var/lib/alsa/asound.state but the content is specific to currently connected soundcards.
What I want is a solution that will apply to any soundcard that will be connected.


Context : why do I want this? I'm providing a ready-to-use Debian image for my project SamplerBox. User #1 might use the computer's built-in-soundcard, User #2 might have a USB DAC, User #3 might have another soundcard…
I would like to provide a default -3dB volume that will work for any ALSA soundcard people could have…


Note: I reinstalled a fresh new system and it seems that, by default, the volume is -20dB for all devices :

enter image description here

enter image description here

Best Answer

There are some generic and driver-specific config files in /usr/share/alsa/init/, where you can specify settings like ENV{ppercent}:="75%" and ENV{pvolume}:="-20dB" (pvolume = playback volume, cvolume = capture volume, etc.). /usr/share/alsa/init/default should already contain those settings, so you can use it as an example.

You can force ALSA to re-initialize all devices with alsactl init and can also override the default configuration files for that with alsactl -i /usr/share/alsa/init/foo init.

For some reason, ALSA seems to ignore the ppercent and pvolume settings on my system, but from your comments it seems like they worked for you. If anyone can enlighten me on why the configuration might be ignored, I'd be glad to amend this answer.

Related Question