You are not logged in.

#1 2011-10-02 15:37:38

R00KIE
Forum Moderator
From: Between a computer and a chair
Registered: 2008-09-14
Posts: 3,621

pavucontrol maximum volume settings (and gtk theme setting)

After the update to pulseaudio 1.0 and pavucontrol 1.0, the latest looks like it doesn't respect the gtk theme I have set. I'm using XFCE. I have traced it to pavucontrol being compiled with gtk3 support, which is explicitly enabled in the PKGBUILD or implicitly enabled by the configure routine if nothing is said. To make it look as intended again I had to reconfigure and recompile pavucontrol with the --disable-gtk3 option. Bug report was opened to raise awareness of this https://bugs.archlinux.org/task/26223. Ok so it seems to be a theme related problem, one problem solved, another to go.

Since the update, the maximum output and input volumes now go to 150% instead of just 100%. For the input it would be fine, although none of the hardware I have really needs that much amplification, however for the outputs anything over 100% (or 0dB) is not desirable as it will introduce clipping and distortion with anything that was recorded properly. Therefore I've been trying to make either pavucontrol or pulseaudio return to the previous behavior of allowing volumes only up to 100%, without much luck I must say.

The first place I've looked was into /etc/pulse/daemon.conf and the new options, specifically enable-deferred-volume but no luck there.

The second place I looked into was /usr/share/pulseaudio/alsa-mixer/paths/analog-output.conf.common. This file seems to be sourced/included by all other analog-output files, a setting that might do the trick would be volume-limit, I've tried creating a [General] section with volume-limit = some value (tried positive and negative numbers) and restarted pulseaudio after saving each change, however it didn't make any difference, most probably I was using it wrong.

I have also tried using the almighty google but mostly I have found only the reference to the inclusion of the volume-limit option and users complaining that the volume with some particular materials was too low and they wanted pulse volume to go up to 150% like in gnome's and kde's mixers. Our great wiki has nothing to say about this too, at least that I could find.

Has anyone stumbled upon this or know how I can get my maximum 100% volume back? I know I can just use volumes only up to 100% but I don't want the slider to show or go past that.

Edit:
Moved the solution to the bad looks to the top of the post to save the long read for most people and added a link to the bug report.

Last edited by R00KIE (2011-10-03 09:54:09)


R00KIE
Tm90aGluZyB0byBzZWUgaGVyZSwgbW92ZSBhbG9uZy4K

Offline

#2 2011-10-02 18:25:47

Ralgo
Member
From: Chile
Registered: 2011-09-30
Posts: 13

Re: pavucontrol maximum volume settings (and gtk theme setting)

Hi, first post!

Well, this is strange. With the arrival yesterday of Gnome 3.2 to extra, now I suffer the same you mention but the opposite case. With Gnome 3.0 the limits of the mixer (operated from the tray or from the multimedia buttons) passed the limit of "no amplification" (100%). Now do not pass the limit of 100% and that makes the sound on my laptop too low.

I am interested in the same solution as you cause I have edited many files and find information on google without any results.

What can be modified to change this behavior?

PD: Sorry, my grammar is awful.

Offline

#3 2011-10-02 19:03:59

R00KIE
Forum Moderator
From: Between a computer and a chair
Registered: 2008-09-14
Posts: 3,621

Re: pavucontrol maximum volume settings (and gtk theme setting)

From what I've seen so far this new behavior is dependent on some attributes of the hardware.

So far I've tried to edit some files (changing the obvious +11dB to 0) and recompiled pulseaudio and pavucontrol but no luck. In my case if I use all volume sliders (device and stream) at 100% I get more than enough volume.


R00KIE
Tm90aGluZyB0byBzZWUgaGVyZSwgbW92ZSBhbG9uZy4K

Offline

#4 2011-10-16 05:24:23

sen
Member
From: .de
Registered: 2007-02-18
Posts: 152
Website

Re: pavucontrol maximum volume settings (and gtk theme setting)

R00KIE wrote:

The second place I looked into was /usr/share/pulseaudio/alsa-mixer/paths/analog-output.conf.common. This file seems to be sourced/included by all other analog-output files, a setting that might do the trick would be volume-limit, I've tried creating a [General] section with volume-limit = some value (tried positive and negative numbers) and restarted pulseaudio after saving each change, however it didn't make any difference, most probably I was using it wrong.

I just installed pulseaudio and encountered the same problem with volume levels. The default amplification was far to high for my sound card... even on 1% it was ridiculously loud. Luckily I configured it with headphones, otherwise I would be deaf now (powerful speaker setup) and the equipment would have been damaged. Pulseaudio is dangerous!

Anyway, your approach was right. You just need to set small positive numbers for the volume-limit function (here is the code). Try to set something like this in '/usr/share/pulseaudio/alsa-mixer/paths/analog-output.conf.common':

[Element PCM]
switch = mute
volume = ignore
volume-limit = 0.01
override-map.1 = all
override-map.2 = all-left,all-right

Then increase from 0.01 until the volume range is suitable for you.

Also, adding "ignore_dB=1":

load-module module-udev-detect ignore_dB=1

in  '/etc/pulse/default.pa' (line 53~) and setting:

flat-volumes = no

in '/etc/pulse/daemon.conf' did make the volume control more usable for me.

Offline

#5 2011-10-16 11:28:12

R00KIE
Forum Moderator
From: Between a computer and a chair
Registered: 2008-09-14
Posts: 3,621

Re: pavucontrol maximum volume settings (and gtk theme setting)

I have tried volume-limit again with the initial value you suggest and indeed it does something but not exactly what I wanted tongue It seems to act as a scaling factor and not as a limiting value, which is what I wanted. Also I still see volume levels above 0dB which I would want to avoid.

Thanks anyway, it didn't do what I wanted but might help other people smile


R00KIE
Tm90aGluZyB0byBzZWUgaGVyZSwgbW92ZSBhbG9uZy4K

Offline

#6 2011-10-17 04:22:23

sen
Member
From: .de
Registered: 2007-02-18
Posts: 152
Website

Re: pavucontrol maximum volume settings (and gtk theme setting)

Yeah you are right, the ability to go above 0dB ist still present. I simply circumvented this issue by creating a volume changer script... actually I just modified the script to work with pulse since I originally created it for oss to change the volume via multimedia keys. Maybe it's useful to you.

pa_vol-notify:

#!/bin/bash

# PulseAudio volume changer and osd for notify-osd
# depends on: notify-osd, pulseaudio
# v1.1 by sen

# -- config --
VOLUME_SAVE="/dev/shm/saved_vol"
STEP=5
VOLUME=$(( $(pacmd dump |grep set-sink-volume |cut -d" " -f3) / 655 ))
DEVICE=$(pacmd dump |grep "set-sink-volume" |cut -d" " -f2)


# -- increase volume --
if [[ $1 = '-i' ]] && [[ VOLUME -lt 100 ]]; then
	if [[ VOLUME+STEP -lt 100 ]]; then
		VOLUME=$((VOLUME+STEP))
	else
		VOLUME=100
	fi
# -- decrease volume --
elif [[ $1 = '-d' ]]&& [[ VOLUME -gt 0 ]]; then
	if [[ VOLUME-STEP -gt 0 ]]; then
		VOLUME=$((VOLUME-STEP))
	else
		VOLUME=0
	fi
# -- toggle mute --
elif [[ $1 = '-t' ]]; then
	if [[ ! -d $VOLUME_SAVE ]]; then
		touch $VOLUME_SAVE
	fi
	if [[ VOLUME -eq 0 ]]; then
		VOLUME=$(cat $VOLUME_SAVE)
	else
		echo $VOLUME >| $VOLUME_SAVE
		VOLUME=0
	fi
else
    exit 1
fi
SET=$((VOLUME*655))
pacmd set-sink-volume $DEVICE $SET > /dev/null

# -- notify-osd --
if [[ VOLUME -eq 0 ]]; then
	ICON=notification-audio-volume-muted
else
	if [[ VOLUME -lt 25 ]]; then
		ICON=notification-audio-volume-off
	elif [[ VOLUME -lt 50 ]]; then
		ICON=notification-audio-volume-low
	elif [[ VOLUME -lt 75 ]]; then
		ICON=notification-audio-volume-medium
	else
		ICON=notification-audio-volume-high
	fi
fi
notify-send "Volume" -i $ICON -h int:value:$VOLUME -h string:x-canonical-private-synchronous:1

usage:
pa_vol-notify -i    --> increase volume
pa_vol-notify -d   --> decrease volume
pa_vol-notify -t    --> toggle mute

note:
If you don't want to use notify-osd delete line 45-59

Last edited by sen (2011-10-17 09:26:28)

Offline

#7 2011-10-17 09:19:13

R00KIE
Forum Moderator
From: Between a computer and a chair
Registered: 2008-09-14
Posts: 3,621

Re: pavucontrol maximum volume settings (and gtk theme setting)

The script looks good but if i'm going to use it I'll need to tweak it a bit, usually I have a usb headset connected so there will be 2 soundcards present (more if I don't disable hdmi output) so I'll either loop through all cards and volumes or try to do something else.


R00KIE
Tm90aGluZyB0byBzZWUgaGVyZSwgbW92ZSBhbG9uZy4K

Offline

#8 2011-10-17 09:39:23

sen
Member
From: .de
Registered: 2007-02-18
Posts: 152
Website

Re: pavucontrol maximum volume settings (and gtk theme setting)

R00KIE wrote:

The script looks good but if i'm going to use it I'll need to tweak it a bit, usually I have a usb headset connected so there will be 2 soundcards present (more if I don't disable hdmi output) so I'll either loop through all cards and volumes or try to do something else.

You could add something like a device selector to the script. Like Defining all devices in a static way and then adding the function "-s #" to select the current device.

Offline

#9 2011-11-29 05:21:48

wecing
Member
From: Seattle, US
Registered: 2009-08-05
Posts: 6
Website

Re: pavucontrol maximum volume settings (and gtk theme setting)

For some laptops, there's a small indicator which shows if the audio is active or not.

I modified sen's script a little to support that. Hope there's no bug inside, because I don't know bash much...

#!/bin/bash

# PulseAudio volume changer and osd for notify-osd
# depends on: notify-osd, pulseaudio
# original version (v1.1) by sen
# current version (v1.2) by wecing

# -- config --
VOLUME_SAVE="/dev/shm/saved_vol"
STEP=5
VOLUME=$(( $(pacmd dump |grep set-sink-volume |cut -d" " -f3) / 655 ))
DEVICE=$(pacmd dump |grep "set-sink-volume" |cut -d" " -f2)
MUTED=$(pacmd dump | grep "set-sink-mute" | cur -d " " -f3)

# -- increase volume --
if [[ $1 = '-i' ]] && [[ VOLUME -lt 100 ]]; then
    if [[ VOLUME+STEP -lt 100 ]]; then
        VOLUME=$((VOLUME+STEP))
    else
        VOLUME=100
    fi
# -- decrease volume --
elif [[ $1 = '-d' ]]&& [[ VOLUME -gt 0 ]]; then
    if [[ VOLUME-STEP -gt 0 ]]; then
        VOLUME=$((VOLUME-STEP))
    else
        VOLUME=0
    fi
# -- toggle mute --
elif [[ $1 = '-t' ]]; then
    if [[ ! -d $VOLUME_SAVE ]]; then
        touch $VOLUME_SAVE
    fi
    if [[ VOLUME -eq 0 ]]; then
        VOLUME=$(cat $VOLUME_SAVE)
    else
        echo $VOLUME >| $VOLUME_SAVE
        VOLUME=0
    fi
else
    exit 1
fi

SET=$((VOLUME*655))
pacmd set-sink-volume $DEVICE $SET > /dev/null

SET_MUTED=0
if [[ VOLUME -eq 0 ]]; then
    SET_MUTED=1
fi

pacmd set-sink-mute $DEVICE $SET_MUTED > /dev/null

# -- notify-osd --
if [[ VOLUME -eq 0 ]]; then
    ICON=notification-audio-volume-muted
else
    if [[ VOLUME -lt 25 ]]; then
        ICON=notification-audio-volume-off
    elif [[ VOLUME -lt 50 ]]; then
        ICON=notification-audio-volume-low
    elif [[ VOLUME -lt 75 ]]; then
        ICON=notification-audio-volume-medium
    else
        ICON=notification-audio-volume-high
    fi
fi

notify-send "Volume" -i $ICON -h int:value:$VOLUME -h string:x-canonical-private-synchronous:1

Last edited by wecing (2011-11-29 05:22:24)


Takk.

Offline

Board footer

Powered by FluxBB