How to save changes made to alsamixer (Squeezelite)

After successfully running a RPi3/DietPi/DragonFly Red combo in Roon, I am trying to set up the same configuration with Squeezelite. I have the thing running OK but the sound output is very low. I have worked out how to set the required PCM level using ssh alsamixer but the setting reverts when the Pi is rebooted/switched off and on. How do I save the changes I make in alsamixer? Id be grateful for any assistance. Thanks, Bob

This shouldn’t happen.
On my OrangePi PC, alsamixer does not lose the settings when I reboot.

alsactl store

Thanks, I gave that a go but it did not work…
On opening alsamixer PCM is 0 [dB gain: -64.00], this results in a very faint sound on my system through the DragonFly Red with the volume at 100%. I change the PCM to 84 [dB gain -4.00] which gives excellent sound quality and full range on the volume controls. Alas, even when using the alsactl store command after entering the change, the PCM setting reverts to 0 following a reboot or shutdown/power up.
Is there anything else I can try?
With thanks, Bob

Strange… Could it be permissions? Are you issuing commands as root or as “ordinary” user? You could try prefixing alsamixer invocation with “sudo”, perhaps, just to be sure (if you are not root)… Also check user and group permissions.

Thanks, strange indeed! Changes made in root (i think) see screen shot below…
I am not all that savvy with command lines - how would I check user and group permissions and what should I be looking for?

Created by : Daniel Knight
Web : http://DietPi.com
Twitter : http://twitter.com/dietpi_
Donate : http://goo.gl/pzISt9
DietPi’s web hosting is powered by: MyVirtualServer.com

dietpi-launcher = All the DietPi programs in one place.
dietpi-config = Feature rich configuration tool for your device.
dietpi-software = Select optimized software for installation.
htop = Resource monitor.
cpu = Shows CPU information and stats.

root@DietPi:~# alsamixer
root@DietPi:~# alsactl store
root@DietPi:~#

Yes, you are issuing those commands as root - thought that perhaps you created another “ordinary” user, so that would make sense.
This way, I really am stumped as to what is going on :frowning:

Im still stumped. In desperation I installed piCorePlayer on a spare card. PCM level in Alsa was 100% and volume was fine. However, in comparison with DietPi, it was less stable over WiFi. Are there any tweaks I can make in the DietPi-config menu that will force higher PCM levels on startup?

Have you tried using ‘amixer’ (the command line mixer) instead of the graphical alsamixer?
It’s definitely less intuitive, but I would give it a try.

Give the following command:

amixer contents

You’ll get an output similar to the following (this is just an example: your output will be different!):

numid=6,iface=MIXER,name='Lineout volume control'
  ; type=INTEGER,access=rw------,values=1,min=0,max=31,step=0
  : values=31
numid=7,iface=MIXER,name='ADC input gain ctrl'
  ; type=INTEGER,access=rw------,values=1,min=0,max=7,step=0
  : values=7
numid=10,iface=MIXER,name='Audio adda drc'
  ; type=BOOLEAN,access=rw------,values=1
  : values=off

Identify the name of the control you need to tweak (it’s the string after name=), and check the maximum value in the following line.
Then give the command:

amixer sset 'name of the control' X

where ‘name of the control’ is the string after name= you had identified earlier and X is the value you want to set to it.
In the example above, if you wanted to set the ‘Lineout volume control’ to its maximum value of 31 you would give the following command:

amixer sset 'Lineout volume control' 31

Adjust as needed and please report back.
Hope this helps.

Thank you for your assistance - If I could trouble you for a bit more guidance.

I worked through your clear and helpful instructions and found that the following command set the required level…

root@DietPi:~# amixer sset PCM Playback Volume 60
Simple mixer control ‘PCM’,0
Capabilities: pvolume pvolume-joined pswitch pswitch-joined
Playback channels: Mono
Limits: Playback 0 - 64
Mono: Playback 60 [94%] [-4.00dB] [on]
root@DietPi:~#

Alas, the setting did not survive a reboot and PCM reverted to ‘0’. Is there another save/store command that I could try?

The right syntax for the command should be

amixer sset ‘PCM Playback Volume’ 60

But if you managed to make it work without the 's maybe it works this way too (I have never tried omitting them).
Unfortunately I don’t know of any other possibly useful commands, I’m sorry.

I would try to reinstall DietPi (maybe even on a different SD card), and see if the problem persists. I have never experienced the problem you are having, and can’t imagine any reason why you are experiencing it other than maybe something went wrong during the first setup. Sorry.

You have been very helpful and there is certainly no need to be sorry. Oddly the PCM volume command did not work when placed within the inverted commas!
I will have a go with another card but for the time being will live with it as it is - I am very pleased with the DietPi resilience and sound - it’s not much trouble to enter alsamixer as and when when required (the Pi lives next to my bed for occasional night time headphone listening and gets turned off when done as the flashing lights are a bit bothersome).
Thanks again and I will report back if I solve this riddle
Cheers
Bob

As a workaround you could write a simple bash script containing the command above to be run at boot, so that the volume would be set to that level automatically every time the machine starts.

Thanks but I’m new to this Linux lark and I wouldn’t know where to start!

Give this command:

crontab -e

It will open a file in the text editor.
At the bottom of the file add this line:

@reboot amixer sset 'PCM Playback Volume' 60

To save the file: Ctrl-X then ‘Y’ to confirm.

Reboot and check if it works.
If it doesn’t, give the “crontab -e” command again and remove the quotation marks from the command. Save and exit (Ctrl-X, then Y) and reboot.
Check if it works and let me know.

Thanks once more. I’ll give that a go later (I’m cooking the Mother’s Day lunch).
Cheers, Bob

There’s no hurry. Have a nice Mother’s Day (in Italy we celebrate it in May) :slight_smile:

Utterly brilliant! Worked like a charm through multiple reboots. It needed the removal of the quotation marks but otherwise i followed your very clear directions.
Had a nice lunch too with both of our mothers (mine is 92, my wife’s Ma is 97)
Molte grazie,
Bob

You’re welcome! Glad it worked, although it’s not really a solution, just a workaround.
Congratulations to your mother’s! I hope they enjoyed their meal and the whole day.
Ciao!