1

I have a sound card lacking hardware volume control (Creative Sound Blaster X-Fi Surround 5.1 connected on USB). Yet PulseAudio seems to think it does have hardware volume control. When I adjust the master volume with pavucontrol nothing happens. How do I force it to do the master volume adjusting in software? (I don't want to use softvol in ALSA in addition to PulseAudio, since this would increase latency and I know PulseAudio does software mixing anyway).

I'm using PulseAudio 5.0.

2 Answers 2

4

Similar situation with an EMU 0202 USB audio card. Alsa shows a "PCM" mixer control that doesn't actually do anything except mute the device.

$ amixer -c USB

Simple mixer control 'PCM',0
  Capabilities: pvolume pswitch pswitch-joined
  Playback channels: Front Left - Front Right
  Limits: Playback 0 - 200
  Mono:
  Front Left: Playback 200 [100%] [0.00dB] [on]
  Front Right: Playback 200 [100%] [0.00dB] [on]

The pulseaudio sink's HW_VOLUME_CTRL flag comes from the alsa-mixer paths configured for the default profile-set:

/usr/share/pulseaudio/alsa-mixer/paths/analog-output.conf.common

[Element PCM]
switch = mute
volume = merge

You can tell pulseaudio to ignore it, and pulseaudio will control the volume in software instead, using something along the lines of:

/usr/share/pulseaudio/alsa-mixer/paths/emu-usb-output.conf

[Element PCM]
switch   = mute
volume   = ignore

/usr/share/pulseaudio/alsa-mixer/profile-sets/emu-usb.conf

[General]
auto-profiles = yes

[Mapping emu-usb-stereo]
device-strings = hw:%f
channel-map = left,right
paths-output = emu-usb-output

Then tell pulseaudio to use your customized profile for this specific card, using either an udev ENV{PULSE_PROFILE_SET}=emu-usb.conf rule, or loading the alsa-card manually:

/etc/pulse/system.pa

load-module module-alsa-card device_id=USB name="emu-usb" card_name="emu-usb" profile_set=emu-usb.conf profile="output:emu-usb-output" ...

This results in a pulseaudio alsa_output.emu-usb.emu-usb-stereo sink without the HW_VOLUME flag, and the normal pulse volume control works from alsa applications.

3
  • Thanks, it took me a while to get the names right and to make the udev rule work, but it works perfectly.
    – Watcom
    Nov 30, 2015 at 23:27
  • Thanks for this! Note that you can use absolute paths for the profile set and paths, so that you don't need to edit files in /usr -- see for example bugzilla.kernel.org/show_bug.cgi?id=110311#c11
    – Jim Paris
    Feb 23, 2020 at 4:15
  • I see this behavior with a cheap USB sound card which does functional hardware master volume for jack output but not for optical output (in the same jack socket).
    – eudoxos
    Mar 10, 2020 at 18:33
0

A solution who seems easier to do and maintain for USB driver was found in in the ArchWiki (again): https://wiki.archlinux.org/index.php/PulseAudio#Keyboard_volume_control

Find your sink label(int) with:

pactl list sinks short

Then you can control the volume and mute the sink corresponding to the USB drivers (let's suppose 1) with:

sh -c "pactl set-sink-mute 1 false ; pactl set-sink-volume 1 +5%"

FInally you can add those commands to your system shortcuts (or alias) to control volume from the keyboard anywhere.

1
  • Thanks, but I don't see how this is related to my question (hardware volume control versus software volume control).
    – Watcom
    Aug 25, 2016 at 16:06

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.