Thursday, October 27, 2011

Fixing volume control in XFCE4

Volume control in XFCE4 worked fine with the volume control in the indicator-applet, but failed to work with the hotkeys on the keyboard, namely:
  • lowering the volume to minimum wouldn't mute
  • muting was possible with the keyboard, unmuting was not
Turns out the problem is caused by xfce4-volumed accessing my sound card directly, while the indicator-applet is using pulse audio. Pulseaudio mirrors the controls of the soundcard, but only partially so for some reason. Proper fix for me: Tell xfce4-volumed to use Pulseaudio, but there either isn't a GUI config for that or it's really well hidden. But there is luckily a command line workaround, use:

xfconf-query -c xfce4-mixer -l

to get a list of soundcards and then tell xfce4-mixer to use that

xfconf-query -c xfce4-mixer -p /active-card -s PlaybackInternalAudioAnalogStereoPulseAudioMixer

Now the volume controls seem to work proper.

Edit: A killall xfce4-volumed might be needed, as otherwise the setting will be instantly reverted.

8 comments:

Doug McCasland said...

Thanks for the tip on how to get Unmute to work! Works great now.

Paul Perkins said...

Thanks, this note was what pointed me the way to solving some strange symptoms related to volume control. I wonder why the xfce4 mixer has both /active-card and /sound-card properties and, in the gui, a stealthy way to set one and no way to set the other (that I have found)? Symptoms of having these point to different mixers (ALSA vs PULSE) vary depending on what strategy PULSE uses to make a sane volume control based on particular sound hardware's mixer capabilities as exposed by ALSA.

ktdreyer said...

Thanks a lot! This fixed my volume controls on Fedora 19 (XFCE 4.10)

Chris Buzzard said...

Hey this worked! BUT my amixer set Master key commands no longer work (well the master toggle does)?

Grumbel said...

You have to use pulseaudio to adjust your volume, not amixer. Something like:

pactl set-sink-volume alsa_output.pci-0000_01_00.1.hdmi-stereo 50%

Will work, you can use also -10%, +10%, etc. for relative adjustments.

Grumbel said...

Use:

pacmd dump

To get a list of devices and their current status.

Chris Buzzard said...

pacmd: command not found?

But I was able to get my amixer commands to work again. I'm using xfce with debian, and in the keyboard application shortcuts I use "amixer set master 5%" and this adjusts the pulse audio I have set up through the native xfce audio mixer. I'm a bit of a newbie and I don't grasp the setting you have in the second to last post.

Chris Buzzard said...

I'm running jessie w/ xfce. I have disabled the flat-volumes for pulse audio. I prefer to keep my application volumes set very high and I control the master volume via the audio mixer. The problem I'm running into now is at reboot pulse audio sets itself to the high or max volume of the first audio application I open. Flash, banshee, parole etc whatever I use. This makes for a sudden miserable surprise when something comes blasting through the speakers (when I forget to preempt the setting). I can't seem to find much online to fix this. Any suggestions?