Page 1 of 1

Specify Alsamixer values

Posted: 26 Oct 2018, 06:53
by chardho
I've been searching the forum as well as the web to determine how to specify Alsamixer values from a configuration file.
Most tutorials, including the below forum post indicate to use 'aslactrl' commands to set the values, however alsactrl does not seem to be installed on the 4.7 iso.
they also refer to the config file being in /var/lib/alsa/asound.state or /etc/asound.state, neither of which exist which I assume is due to the lack of asactrl.

Is there any way of specifying these values from another config file or possibly using the run_command?

thanks,

Chardho

Specify Alsamixer values

Posted: 26 Oct 2018, 08:22
by fanthom
Hello chardho,

Please explain why you cant use official 'volume_level=' parameter.

Specify Alsamixer values

Posted: 26 Oct 2018, 16:53
by chardho
Because I want to be able to control not only the master volume but also the Mic volume and Mic Boost parameters as well as PCM which seems to be maxed out when the system boots.

Specify Alsamixer values

Posted: 26 Oct 2018, 17:39
by fanthom
In this case you could host 'alsactl' and previously generated asound.state file on some web storage and use 'run_command=' parameter to download them during system boot and restore your preferred values.

This way you'll be able to avoid remastering the ISO.

sample:

Code: Select all

run_command=wget https://domain.com/files/alsactl; wget https://domain.com/files/asound.state; chmod +x alsactl; /root/alsactl -f /root/asound.state restore
did not test but you should get the idea.

Specify Alsamixer values

Posted: 26 Oct 2018, 18:41
by chardho
fanthom,

thanks for the quick reply. This seems like a better solution than dealing with trying to create a module for alsa-utils as handling the dependencies has become a bit of a problem.
couple of questions.
Is alsactl not part of alsa-utils which has dependencies? I was not aware that it was simply a file I could load on demand.
Is asound.state a file that is built when alsa-utils are installed or is it a file that is created by the user simply for saving alsa state?

chardho

Specify Alsamixer values

Posted: 26 Oct 2018, 19:57
by chardho
I think I found a better answer that is more simple and utilizes a tool already included in PK.

amixer allows you to change the volume settings on the fly from the command line and can therefore be implemented easily using the run_command

https://unix.stackexchange.com/question ... m-terminal

running 'amixer' without argument will list all cards and associated controls recognized by alsa. Below is my output.

Simple mixer control 'Master',0
Capabilities: pvolume pswitch
Playback channels: Front Left - Front Right
Limits: Playback 0 - 87
Mono:
Front Left: Playback 75 [86%] [-9.00dB] [off]
Front Right: Playback 75 [86%] [-9.00dB] [off]
Simple mixer control 'Mic',0
Capabilities: pvolume pswitch
Playback channels: Front Left - Front Right
Limits: Playback 0 - 31
Mono:
Front Left: Playback 10 [32%] [-19.50dB] [off]
Front Right: Playback 10 [32%] [-19.50dB] [off]
Simple mixer control 'Mic Boost',0
Capabilities: volume
Playback channels: Front Left - Front Right
Capture channels: Front Left - Front Right
Limits: 0 - 3
Front Left: 2 [67%] [20.00dB]
Front Right: 2 [67%] [20.00dB]
Simple mixer control 'Capture',0
Capabilities: cvolume cswitch
Capture channels: Front Left - Front Right
Limits: Capture 0 - 63
Front Left: Capture 0 [0%] [-17.25dB] [off]
Front Right: Capture 0 [0%] [-17.25dB] [off]
Simple mixer control 'Loopback Mixing',0
Capabilities: enum
Items: 'Disabled' 'Enabled'
Item0: 'Disabled'


Now I can run simple commands to change the values on the fly
'amixer -M set 'Master' 70%
'amixer -M set 'Mic' 30%
'amixer -M set 'Mic Boost' 30%

now these can be placed into a run command easily and run at boot time.
amixer -h gives alternate options for selecting specific cards etc...

Specify Alsamixer values

Posted: 27 Oct 2018, 04:48
by fanthom
Yes - we use amixer in our /etc/rc.d/rc.sound script.
Glad you found the solution.