9

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

  • There are some generic and driver-specific config files in /usr/share/alsa/init/, but settings like ENV{ppercent}:="75%" and ENV{pvolume}:="-20dB" (pvolume = playback volume, cvolume = capture volume) seem to be ignored, even when explicitly selecting one of the files with alsactl -i /usr/share/alsa/init/default init – n.st Jun 17 '15 at 1:26
  • Hum this is strange @n.st ... Do you see then how we could deal with that? – Basj Jun 17 '15 at 9:06
  • @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 – Basj Jun 17 '15 at 9:25
  • @n.st This config file works for me! On all devices I have tested! You can post as answer if you want :) – Basj Jun 17 '15 at 16:18
3

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.

  • I seem to be having the same issue. In /usr/share/alsa/init/default I have ENV{ppercent}:="75%". However, whenever I plug a USB DAC it always starts up with 0% volume. Any ideas how to fix this? – landroni Aug 7 '15 at 14:36
  • @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… – n.st Aug 7 '15 at 14:57
  • Are there perhaps some user-level config files that can be used to override (non-working) defaults? – landroni Aug 7 '15 at 15:00
  • @landroni No idea, sorry. :( – n.st Aug 7 '15 at 15:28
  • OK, thanks. I guess this warrants a new question... – landroni Aug 7 '15 at 15:52
10

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.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.