The One with the Thoughts of Frans

Archive for October, 2015

PulseAudio: How to Decouple Application Volumes And Global Volume

I wondered why e.g. my VLC volume kept getting lowered. As it turns out, there was a change.

PulseAudio seems to have copied one of Windows 6+’s most annoying features, at least in terms of the media framework: flat volumes.

Quick refresher: This is that annoying thing that Windows (and now, PulseAudio, by default) does, where turning up the volume in an application will increase the master system volume alongside it. This has the side-effect that any application which sets its own volume can commandeer the master volume of your system. Why is this bad? The short answer is headphones.

It’s not as if it’s only headphones that can blare at ridiculously loud volumes. Anyway, a quick search came up with this helpful suggestion regarding the flat-volumes setting.

PulseAudio supports per-application volume control, but by default this doesnt do much as you can only control these volumes from the pulseaudio volume control utility. Meaning that in an application like Audacious, when the output device is set to PulseAudio, and the volume control is set to hardware, it will adjust the master volume control, not the per-application volume control.

To fix this behavior, set the following in /etc/pulse/daemon.conf

flat-volumes = no

Now whenever Audacious goes to adjust the volume, it will adjust the audacious only volume and thus you wont have multiple applications fighting over the master volume control.

What a horribly annoying new default.

Comments

Working around the broken Creative HS-720 headset

A few years ago I received a Creative HS-720 as a gesture of good will. I wasn’t displeased, but since I didn’t need it I didn’t really investigate. Recently I’ve been wanting to use it as a headphone and noticed that even at the lowest possible volume, it was still significantly too loud. What’s really crazy is that there are actually positive reviews for the product out there. Read this negative one instead. That’s all you need to know. Avoid this product. Ideally I’d acquire something like an Asus Xonar U3, a Creative Sound Blaster Play! 2 or a Creative Sound Blaster E1 in combination with proper headphones (although the HS-720 certainly doesn’t make me want to buy another Creative product), but I figured there just had to be a software solution.

Some searching gave me “Fix for USB Audio is Too Loud and Mutes at Low Volume in Ubuntu.” The title isn’t quite accurate, because it’s a workaround. No matter. It requires modifying the file /usr/share/pulseaudio/alsa-mixer/paths/analog-output.conf.common. But we might as well take a look at what else there is to play with while we’re at it.

/usr/share/pulseaudio/alsa-mixer/paths$ ls
analog-input-aux.conf                  analog-input-mic.conf               analog-output-lineout.conf
analog-input.conf                      analog-input-mic.conf.common        analog-output-mono.conf
analog-input.conf.common               analog-input-mic-line.conf          analog-output-speaker-always.conf
analog-input-dock-mic.conf             analog-input-rear-mic.conf          analog-output-speaker.conf
analog-input-fm.conf                   analog-input-tvtuner.conf           hdmi-output-0.conf
analog-input-front-mic.conf            analog-input-video.conf             hdmi-output-1.conf
analog-input-headphone-mic.conf        analog-output.conf                  hdmi-output-2.conf
analog-input-headset-mic.conf          analog-output.conf.common           hdmi-output-3.conf
analog-input-internal-mic-always.conf  analog-output-desktop-speaker.conf  iec958-stereo-output.conf
analog-input-internal-mic.conf         analog-output-headphones-2.conf
analog-input-linein.conf               analog-output-headphones.conf

As you can see there’s a bunch of PulseAudio profiles. In my case I might be able to adjust one of the headphones files without changing the entire system, but as luck would have it I use a digital IEC958 output for my main sound system, so I could afford mess up all handling of analog output for the sake of these headphones. I’ll quote part of Chris Jean’s guide in case linkrot ever strikes.

Search for the text “Element PCM”. You should see the following text:

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

Update this section of text to look like the following (changes are in bold):

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

Note that the value 0.01 can be adjusted as needed to change how quiet and loud the volume is. Making the number smaller reduces the max volume while making the number larger increases the max volume. I tested out 0.05 and found that the max volume was much louder than I would ever use. I also decided that 0.01 was technically louder than I’d ever use. I ended up with a value of 0.0075 (0.005 was too quiet) which I felt gave a good maximum volume and resulted in better overall control over the volume range.

I’d add that it seems to work fine with volume-limit = 1.0 as well. After making that change run killall pulseaudio (or pulseaudio -k, but why bother with something non-generic) to get it to work.

You can do some more volume play using alsamixer, but you’ll have to figure out which device to use first.

$ pacmd list-sources | grep -e device.string -e 'name:'
	name: <alsa_output.pci-0000_01_00.1.hdmi-stereo.monitor>
		device.string = "1"
	name: <alsa_input.usb-046d_0990_E1C9E823-02-Q9000.analog-mono>
		device.string = "hw:2"
	name: <alsa_output.pci-0000_00_14.2.iec958-ac3-surround-51.monitor>
		device.string = "0"
	name: <alsa_output.usb-Creative_Technology_Ltd._Creative_HS-720_Headset-00-Headset.analog-stereo.monitor>
		device.string = "3"

As you can see the headset is device 3. You can print some more info using amixer.

$ amixer -c 3
Simple mixer control 'PCM',0
  Capabilities: pvolume pswitch pswitch-joined
  Playback channels: Front Left - Front Right
  Limits: Playback 0 - 38
  Mono:
  Front Left: Playback 9 [24%] [-21.67dB] [on]
  Front Right: Playback 9 [24%] [-21.67dB] [on]
Simple mixer control 'Mic',0
  Capabilities: cvolume cvolume-joined cswitch cswitch-joined
  Capture channels: Mono
  Limits: Capture 0 - 16
  Mono: Capture 14 [88%] [20.83dB] [on]
Simple mixer control 'Auto Gain Control',0
  Capabilities: pswitch pswitch-joined
  Playback channels: Mono
  Mono: Playback [on]

And using alsamixer -c 3 you can play around with the volume a bit more, too.

My only regret is that I haven’t been able to find something like Identifier for xorg.conf. Oh well, it’ll save me some money in the short term.

PS On Windows, try EqualizerAPO (source).

Comments (1)