Hello I have tryed out the programm "EarCandy", now I had/have a lot of problems. At first I did not get any sound and now it is very low volume. PS Earcandy is now deleted from my harddisk.
When Im opening the Alsamixer with:
alsamixerI see that the volume for the speakers is zero. Now I push it to the max volume. But after every restart, I have to open alsamixer again and have to set the volume to max again. Can I save the settings for alsamixer or is there any other way to fix the problem ?
11 Answers
Execute:
sudo alsactl storeThis should save alsamixer configurations to /etc/asound.state which gets loaded every startup.
You could also save the mixer settings into a custom file with alsactl:
alsactl --file ~/.config/asound.state storeReloading:
alsactl --file ~/.config/asound.state restore 2 Seppo Erviälä's answer is right but not complete. As dma_k already noted, man alsactl clearly states at the end that,
/var/lib/alsa/asound.state (or whatever file you specify with the -f flag) is used to store current settings for your soundcards.
palacsinit appropriately noted that you can store config into your file with
alsactl --file ~/.config/asound.state storeand reload with
alsactl --file ~/.config/asound.state restoreThis can be further improved with placing the second line, the restore command into a .desktop file.
You will need to run nano ~/.config/autostart/alsarestore.desktop, which will open nano text editor and create ~/.config/autostart/alsarestore.desktop file. Entries in ~/.config/autostart/ directory are used to autostart programs and services for specific user on startup/graphical login.
The contents of the .desktop file should be the following:
[Desktop Entry]
Type=Application
Terminal=false
Name=alsarestore
Exec=alsactl --file ~/.config/asound.state restoreAmong other things, you could store your config in /etc/asound.state and symlink it to /var/lib/alsa/asound.state, but this one is more of a suggestion rather than tested solution
After 2 months of trying to make sudo alsactl store to work, I finally managed to do it.
Firstly type in terminal alsamixer to enter the alsamixer UI. Then make the configurations you need(e.g increase speakers/headphones level or unmute something pressing "m" on keyboard).
Now the most important part. Before you exit alsamixer, open a new terminal and run sudo alsactl store to save alsa settings. Then close both terminals and restart your computer. This will do the job.
The solution of Sergiy Kolodyazhnyy worked for me. Although I had to add the modification of Exec=bash -c "sleep 5 .... Indeed this happens because PulseAudio is modifying ALSA.
Another solution is to disable PulseAudio during boot (see here):
sudo cp /etc/pulse/client.conf /etc/pulse/client.confbackup
sudo nano /etc/pulse/client.confFind ; autospawn = yes, remove the ; and change it to:
autospawn = noThis solution also worked for me, although Ubuntu gave me a system program error at start. As I hate this kind of messages, I used the first solution.
Open alsamixer with sudo privilege:
sudo alsamixerThen adjust the volume and exit.
sudo alsactl store ALSA has a mechanism to save and restore settings:
# alsactl store
# alsactl restoreIt will use a default file (usually /var/lib/alsa/asound.state) to save settings, and restore them from. The restore operation is usually done automatically at system bootup, usually from a systemd service.
However, it may happen that PulseAudio (the audio server that is often used by default on "recent" distributions), will override the ALSA settings by its own, sometimes messing up things. It may not so easy to teach PulseAudio to behave as you'd like, so a workaround of this kind might be used:
You may want to launch the following script (~/alsarestore.sh) from the root user crontab.
#!/bin/sh
restore_alsa() { while [ -z "$(pidof pulseaudio)" ]; do sleep 1 done alsactl restore
}
restore_alsa &It will wait for PulseAudio to launch before calling alsactl restore (considering the stored configuration is the one you want).
Finally, as root, you may want to add this to crontab -e:
@reboot ~/alsarestore.sh 2>/dev/nullThis work around is inspired from this ArchLinux wiki article.
2After running sudo alsamixer the mixer should should retain the changes you make.
See Sound does not work once my profile loads on which answers you can find a clue also.
Good luck!
Alsa-Json-Gateway supports store/restore of sound card sessions from JSON/REST API
- list sessions /jsonapi?request=session-list&cardid=hw:0
- store session /jsonapi?request=session-store&cardid=hw:0&args=MySoundConfig
- restore /jsonapi?request=session-load&cardid=hw:0&args=MySoundConfig
For those whom @Sergiy Kolodyazhnyy 's answer didn't work, try replacing alsactl by its complete path (whatever the which alsactl returned to you).
Alsa resets the volume for mic, headphones and speaker for my system. So I executed following commands to store and restore alsa setting.
Following commands restores the default state
sudo alsactl restore
Then run following command and adjust the volume as per your need.
sudo alsamixer
Make sure you select correct soundcard for which you want to modify the setting.
After setting up sound level, exit the alsamixer and store the setting using following command
sudo alsactl store
To verify the setting is saved you can check the file 'asound.state' which is stored at location /var/lib/alsa/asound.state (use locate command if you want to know the location of the file in your system)
To restore the setting after system reboots, use following command
sudo alsactl restore