2

I am using Debian 8.7. I normally select the sound card I want to use and disable sound alerts through the sound options in Settings. However, these are never saved and on reboot I have to go in to Settings and set them again each time. Is there a way to save sound settings so that this doesn't have to be done each reboot? Here is the inxi info on the card and drivers:

Audio:     Card-1 Advanced Micro Devices [AMD/ATI] Cypress HDMI Audio [Radeon HD 5800 Series] 
           driver: snd_hda_intel 
           Card-2 Creative Labs SB X-Fi driver: snd_ctxfi 
           Card-3 Intel 82801JI (ICH10 Family) HD Audio Controller 
           driver: snd_hda_intel 
           Sound: Advanced Linux Sound Architecture v: k3.16.0-4-amd64

And the contents of /var/lib/alsa/asound.state

https://pastebin.com/5f3PwBHE

  • Are you running Pulseaudio? If not, alsactl as mentioned in the answer. The Debian package alsa-utils provides scripts to restore them on boot. Note that these are ALSA mixer settings, like those you see in alsamixer, not whatever the "disable sound alerts" Gnome setting does. If this is something Gnome related, you need to restore Gnome settings on boot. But I've given up on understanding the Gnome configuration system. – dirkt Apr 28 '17 at 12:13
  • @dirkt I believe I am running Pulse. I used Puva control and that was able to control the sound settings, though the setting weren't saved on reboot. I have used alsamixer but not alsa-utils, I believe, so I could try that. – C26 Apr 28 '17 at 14:50
3

I will post what solved the issue for me, which is the top answer to this question here:

https://askubuntu.com/questions/398030/change-default-sound-device

Using this and the help given by dirkt the steps I took were:

pacmd list-cards - this gave my X-Fi as index 2.

The profile setting was actually identical to that in the above linked answer, which is 2 output:analog-stereo. I then entered the following pacmd set-card-profile 2 output:analog-stereo

Then I added

set-card-profile 2  output:analog-stereo
set-default-sink 2

to the end of /etc/pulse/default.pa

And on reboot the X-Fi was still selected, no changes had to be made in Sound to reselect the card.

2
+100

Let's sort out the various sound settings.

Your sound hardware is controlled by the ALSA kernel drivers, the ALSA library provides access to those drivers, and there are various volume/mute controls and you change with alsamixer or amixer. Some of these settings may also be exposed via Gnome. I usually leave them alone, and only modify things if something doesn't work.

You can save and restore these settings with alsactl store and alsactl restore, and the Debian packages alsa-utils contains a script which restores them from /var/lib/alsa/asound.state.

Pulseaudio runs on top of ALSA. You can change Pulseaudio settings in pavucontrol and in other ways. Pulseaudio remembers some of its settings, but there's no general way to store or restore them; if you want to make Pulseaudio settings appear on boot, you have to fiddle with the Pulseaudio setup.

As I don't run the Gnome desktop, I don't know what "disable sound alerts" actually does. It may be a Gnome settings, and in that case you have to figure out how to restore Gnome settings on boot. The Gnome settings database has various utilities like dconf and gsettings, but usage has apparently changed over versions and I never could completely understand how everything work.

So, if you are mainly interested in "disable sound alerts", you need to figure out what exactly it does and what it changes.

Edit:

So the Sound Effect settings are definitely a Gnome thing, so you need to research how to make Gnome settings permanent, or set them on boot.

alsa-utils restores settings on boot by providings scripts for SysV Init (/etc/init.d/alsa-utils) and systemd (/lib/systemd/system/alsa-*) which call basically alsactl restore /var/lib/alsa/asound.stat). So when you call alsactl store as root, it will write the current settings to this file, and they will be restored on boot.

It's possible that the "selected" output shown in the Gnome menu is a wrapper for the default Pulseaudio sink. You can set this sink with pacmd set-default-sink (use pacmd list-sist-sinks | grep name: to list the name of the sinks), and I think in pavucontrol, too. Pulseaudio will remember it. It's also possible that this is again a Gnome setting that overrides what Pulseaudio does.

  • Pavu remembers the settings I inputted from several reboots ago, but they still reset overall on reboot so the issue must be with alsa. Thankfully I think we have sussed that part of it. As for the /var/lib/alsa/asound.state script, this contains 1046 control entries for my X-Fi card! I have no idea where to start to look for what to change so that the sound settings are recalled on reboot, but it may be somewhere inside that file. The file code is here pastebin.com/5f3PwBHE – C26 Apr 29 '17 at 10:52
  • You still haven't said which sound settings are you interested in: ALSA mixer settings, Pulseaudio settings, or Gnome "sound alerts" (whatever they are)? What specifically? You don't have to change anything in /var/lib/alsa/asound.state, these are your ALSA mixer settings at the time they were saved. Yes, more complicated soundcards have a lot of them. But somehow I doubt you changed any of these, or want them restored, unless you can name which setting or which effect you are interested in. What is the setting supposed to do? – dirkt Apr 29 '17 at 10:58
  • The 'sound alerts' within GNOME are things like the log-in sound, the sound [a 'drip' noise] whenever the speaker volume is increased or decreased etc. Actually they appear to be called 'sound effects' - sorry about that! I disable these within the Sound Menu in Settings [here - s16.postimg.org/dyb7e0v6t/sound.png] but they always come back on reboot, and Digital Output is always selected instead of Analog [which is what I want and what works on my computer]. I am interested in storing ALSA mixer settings for reboot but I don't know how to do this since alsactl store doesn't do it. – C26 Apr 29 '17 at 11:08
1

alsactl store should store the mixer settings. Not sure if they are loaded at boot by default in Debian, but they can be restored with the alsactl restore command.

  • Thank you for this. This didn't work though - it didn't store the settings on reboot and the restore command didn't do anything, unfortunately. – C26 Apr 26 '17 at 17:31

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.