Default sound volume for all ALSA devices
Solution 1
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.
Solution 2
I just wandered upon this post and see you are struggling with the answer to this as I was. This is what fixed it for me:
Go into alsamixer and set everything the way you want it, then exit and type this:
sudo alsactl store
That will store the current config of alsamixer and it should keep the config.
Related videos on Youtube
jiffy.of.eternity
Updated on September 18, 2022Comments
-
jiffy.of.eternity over 1 year
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 evenalsamixer
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 :
-
n.st almost 9 yearsThere are some generic and driver-specific config files in
/usr/share/alsa/init/
, but settings likeENV{ppercent}:="75%"
andENV{pvolume}:="-20dB"
(pvolume = playback volume, cvolume = capture volume) seem to be ignored, even when explicitly selecting one of the files withalsactl -i /usr/share/alsa/init/default init
… -
jiffy.of.eternity almost 9 yearsHum this is strange @n.st ... Do you see then how we could deal with that?
-
jiffy.of.eternity almost 9 years@n.st It seems that -20 dB is the default volume for all soundcards, when I reinstalled a fresh new Debian Jessie with
alsa-utils
-
jiffy.of.eternity almost 9 years@n.st This config file works for me! On all devices I have tested! You can post as answer if you want :)
-
-
landroni almost 9 yearsI seem to be having the same issue. In
/usr/share/alsa/init/default
I haveENV{ppercent}:="75%"
. However, whenever I plug a USB DAC it always starts up with0%
volume. Any ideas how to fix this? -
n.st almost 9 years@landroni I haven't investigated this further, so I still don't know why ALSA would use those config files on some systems but ignore them on others…
-
landroni almost 9 yearsAre there perhaps some user-level config files that can be used to override (non-working) defaults?
-
n.st almost 9 years@landroni No idea, sorry. :(
-
landroni almost 9 yearsOK, thanks. I guess this warrants a new question...
-
jiffy.of.eternity over 7 yearsIndeed! This is the solution I also finally found: samplerbox.org/faq#volume.