How to force software master volume control in PulseAudio?
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.
Related videos on Youtube
Watcom
What's 10,000 years but a grain of sand in the hourglass of eternity? λ
Updated on September 18, 2022Comments
-
Watcom over 1 year
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.
-
Watcom over 8 yearsThanks, it took me a while to get the names right and to make the udev rule work, but it works perfectly.
-
Watcom over 7 yearsThanks, but I don't see how this is related to my question (hardware volume control versus software volume control).
-
Jim Paris about 4 yearsThanks 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 -
eudoxos about 4 yearsI 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).