Thank you for your donation!


Cloudsmith graciously provides open-source package management and distribution for our project.


Hardware volume resetting
#5
(12-20-2018, 07:09 PM)Tim Curtis Wrote: Thats interesting, I also see 4 dB gain at ALSA 100% for the on-board audio device. It could be a Kernel bug.

I'll do some checking...

Granted I was trying understand the software (not hardware) volume, ALSA configs are not the source for where the volume is set to 100% with 4dB gain.  Instead I discovered default levels are set by "/var/www/command/worker.php".  Line 566 of worker.php is where I found modifying the end of sysCmd from 100 to 95 achieved the desired result since setting volume from the web interface is not persistent with reboots.  The problem may be illustrated by running an example of the same command that "/var/www/command/util.sh" will call on line 84.

Example of current problem:

    pi@moode:~ $ amixer -c 0 sset "'PCM'" 100%
    Simple mixer control 'PCM',0
    Capabilities: pvolume pvolume-joined pswitch pswitch-joined
    Playback channels: Mono
    Limits: Playback -10239 - 400
    Mono: Playback 400 [100%] [4.00dB] [on]

versus adding the parameter to specify gain dB in addition to volume percent gets this result, which is what I was looking for to avoid clipping.

    pi@moode:~ $ amixer -c 0 sset "'PCM'" 0,100%
    Simple mixer control 'PCM',0
    Capabilities: pvolume pvolume-joined pswitch pswitch-joined
    Playback channels: Mono
    Limits: Playback -10239 - 400
    Mono: Playback 0 [96%] [0.00dB] [on]

*Notice that 0 dB gain plus 100% volume translates to 96%.  Adding " 0," on line 566 of "/var/www/command/worker.php" should fix this bug to prevent clipping as a default persistent state after rebooting.

Bottom line quick fix, edit line 566 of "/var/www/command/worker.php" to the following

$result = sysCmd('/var/www/command/util.sh set-alsavol ' . '"' . $_SESSION['amixname']  . '"' . ' 0,100');

** I still experienced some noticeable clipping at 100% on an rPi2 model B, so playing it safe at 96% in my own config.
Reply


Messages In This Thread
Hardware volume resetting - by cyolcu - 12-20-2018, 03:01 PM
RE: Hardware volume resetting - by Tim Curtis - 12-20-2018, 03:20 PM
RE: Hardware volume resetting - by cyolcu - 12-20-2018, 06:30 PM
RE: Hardware volume resetting - by Tim Curtis - 12-20-2018, 07:09 PM
RE: Hardware volume resetting - by jar03j - 05-20-2019, 09:41 PM
RE: Hardware volume resetting - by Tim Curtis - 05-20-2019, 11:50 PM
RE: Hardware volume resetting - by jar03j - 05-21-2019, 12:22 AM

Forum Jump: