Default sound volume for all ALSA devices

28,805

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.

Share:
28,805

Related videos on Youtube

jiffy.of.eternity
Author by

jiffy.of.eternity

Updated on September 18, 2022

Comments

  • jiffy.of.eternity
    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 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

    • n.st
      n.st almost 9 years
      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
    • jiffy.of.eternity
      jiffy.of.eternity almost 9 years
      Hum this is strange @n.st ... Do you see then how we could deal with that?
    • jiffy.of.eternity
      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
      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
    landroni almost 9 years
    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?
  • n.st
    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
    landroni almost 9 years
    Are there perhaps some user-level config files that can be used to override (non-working) defaults?
  • n.st
    n.st almost 9 years
    @landroni No idea, sorry. :(
  • landroni
    landroni almost 9 years
    OK, thanks. I guess this warrants a new question...
  • jiffy.of.eternity
    jiffy.of.eternity over 7 years
    Indeed! This is the solution I also finally found: samplerbox.org/faq#volume.