alsa-project/alsa-ucm-conf

Alsamixer not detecting headphones

lgmventura opened this issue · 32 comments

I'm using the motherboard ASUS ROG Strix B760-f Gaming Wifi, which has 7.1 audio channels on the back side and connectors for an audio panel at the front of the case - a microphone and a headphones jack.

When I plug my headphones into the front channels connector (at the back of the PC case) there is normal sound. When I plug it into the headphones jack (at the front of the case), it gets automatically detected by pavucontrol, which switches to the headphones as output, as it should be:
image

However, there is no sound. When I open alsamixer and choose the respective soundcard, which is weirdly called "USB audio" there, I see no volume control for the headphones, as there should be. All it shows is this:
image

The only way I got to get audio output from the headphones jack is by running aplay and choosing the hardware directly from there aplay -D plughw:1,1 /usr/share/sounds/alsa/Front_Center.wav or on Audacity by selecting "USB Audio 1: (hw:1,1)" as playback device.

I also tried to use JACK Audio Connection Kit, but found no configuration there that routes the audio to the headphones jack, even trying all 4 possible analogue outputs.

System:

  • Motherboard ASUS ROG Strix B760-f Gaming Wifi
  • Intel core i7-13700K
  • Ubuntu 22.04 (freshly installed)

Attach output from alsa-info.sh --no-upload, please.

which is weirdly called "USB audio" there

You have really an USB sound card on the motherboard with ALC4080/82 USB chip and the hardware vendor didn't bother to set a better text to the USB audio descriptor table.

@perexg Where do I find this file? I get alsa-info.sh: command not found

Is maybe this? /usr/sbin/alsa-info

Curl downloaded the file correctly, but when I run tar xvzf alsa-ucm-conf.tar.gz -C /usr/share/alsa --strip-components=1 "*/ucm" "*/ucm2", I'm getting:

tar: Pattern matching characters used in file names
tar: Use --wildcards to enable pattern matching, or --no-wildcards to suppress this warning
tar: */ucm: Not found in archive
tar: Pattern matching characters used in file names
tar: Use --wildcards to enable pattern matching, or --no-wildcards to suppress this warning
tar: */ucm2: Not found in archive
tar: Exiting with failure status due to previous errors

Although the folders are there:
image

I corrected the command for your distro. See again https://github.com/alsa-project/alsa-ucm-conf/blob/master/README.md .

I managed to run the 2 lines following "The latest configuration can be obtained with those commands:". The second one only with sudo. I rebooted the system and alsamixer still looks exactly the same as before. Am I missing something?

Which version of the alsa-lib package do you have in your distro ? Do you see an error with the command alsaucm -c 0 dump text ?

Hi, checking cat /proc/asound/version, I get: Advanced Linux Sound Architecture Driver Version k5.19.0-32-generic..
The command alsaucm -c 0 dump text gives me:

ALSA lib main.c:1412:(snd_use_case_mgr_open) error: failed to import 0 use case configuration -2
alsaucm: error failed to open sound card 0: No such file or directory

I also tested with -c 1, but it gives me the same error with value 1 instead.

Sorry, it should be alsaucm -c hw:0 dump text.

Thanks! I get this output:

ALSA lib parser.c:2021:(parse_master_file) Incompatible syntax 6 in HDA-Intel.conf
ALSA lib main.c:1412:(snd_use_case_mgr_open) error: failed to import hw:0 use case configuration -22
alsaucm: error failed to open sound card hw:0: Invalid argument

Then try hw:1. 0 is probably your HDMI sound card.

The same:

ALSA lib parser.c:2021:(parse_master_file) Incompatible syntax 6 in USB-Audio.conf
ALSA lib main.c:1412:(snd_use_case_mgr_open) error: failed to import hw:1 use case configuration -22
alsaucm: error failed to open sound card hw:1: Invalid argument

But for 2, it's slightly different:

ALSA lib confmisc.c:165:(snd_config_get_card) Cannot get card index for 2
ALSA lib parser.c:2412:(uc_mgr_import_master_config) card 'hw:2' is not valid
ALSA lib main.c:1412:(snd_use_case_mgr_open) error: failed to import hw:2 use case configuration -2
alsaucm: error failed to open sound card hw:2: No such file or directory

It's not same:

ALSA lib parser.c:2021:(parse_master_file) Incompatible syntax 6 in USB-Audio.conf

Upgrade alsa-lib package...

Ah, yes, true. How can I upgrade it on Ubuntu? I tried with:

sudo apt update
sudo apt install libasound2

according to an online help and I get: libasound2 is already the newest version (1.2.6.1-1ubuntu1)..

Unfortunately, you are asking the upstream for the support not your distribution. The alsa-lib 1.2.8 was released before 4 months, 1.2.7 before 7 months. Move your question to your distro support.

Sorry. I'll check there, thanks. What distro do you use? Do you know of a distro that is more friendly to the newest versions of packages?

1.2.6.1 is the newest supported by Ubuntu 22.04. I think it's just that this motherboard is newer than the newest Ubuntu LTS at the moment. I'll play with the non-LTS 22.10 later to test it there...

Hi, I just tested it on Ubuntu 22.10 (preview mode, i.e. without installing it). This should have alsa-lib 1.2.7.2 by default (see https://launchpad.net/ubuntu/+source/alsa-lib). The appearance of alsamixer is the same (not showing headphones) and those commands produce:

$ alsaucm -c hw:0 dump text
ALSA lib parser.c:244:(error_node) UCM is not supported for this HDA model (HDA Intel PCH at 0x6003220000 irq 196)
ALSA lib main.c:1541:(snd_use_case_mgr_open) error: failed to import hw:0 use case configuration -6
alsaucm: error failed to open sound card hw:0: No such device or address

and

$ alsaucm -c hw:1 dump text
ALSA lib parser.c:244:(error_node) UCM is not supported for this USB device (Generic USB Audio at usb-0000:00:14.0-11, high speed @ USB0b05:1a52)
ALSA lib main.c:1541:(snd_use_case_mgr_open) error: failed to import hw:1 use case configuration -6
alsaucm: error failed to open sound card hw:1: No such device or address

Update to latest configuration files (tar command) like I suggested before. Those changes are not released yet.

Tried again on Ubuntu 22.10 (preview mode) and it already looks better:

alsaucm -c hw:1 dump text
Verb.HiFi {
	Comment "HiFi 2.0 channels"
	Device.Speaker {
		Comment Speakers
		Values {
			CaptureCTL "_ucm0001.hw:Audio"
			JackControl "Speaker - Output Jack"
			PlaybackCTL "_ucm0001.hw:Audio"
			PlaybackChannels 2
			PlaybackMixerElem PCM,0
			PlaybackPCM "_ucm0001.hw:Audio"
			PlaybackPriority 200
			TQ HiFi
		}
	}
	Device.Headphones {
		Comment "Front Headphones"
		Values {
			CaptureCTL "_ucm0001.hw:Audio"
			JackControl "Headphone - Output Jack"
			PlaybackCTL "_ucm0001.hw:Audio"
			PlaybackMixerElem PCM,1
			PlaybackPCM "_ucm0001.hw:Audio,1"
			PlaybackPriority 300
			TQ HiFi
		}
	}
	Device.SPDIF {
		Comment "S/PDIF Output"
		Values {
			CaptureCTL "_ucm0001.hw:Audio"
			PlaybackCTL "_ucm0001.hw:Audio"
			PlaybackMixerElem PCM,2
			PlaybackPCM "_ucm0001.hw:Audio,2"
			PlaybackPriority 100
			TQ HiFi
		}
	}
	Device.Line1 {
		Comment "Line Input"
		Values {
			CaptureCTL "_ucm0001.hw:Audio"
			CaptureMixerElem Line,0
			CapturePCM "_ucm0001.hw:Audio,1"
			CapturePriority 100
			JackControl "Line - Input Jack"
			PlaybackCTL "_ucm0001.hw:Audio"
			TQ HiFi
		}
	}
	Device.Mic1 {
		Comment Microphone
		Values {
			CaptureCTL "_ucm0001.hw:Audio"
			CaptureMixerElem Mic,0
			CapturePCM "_ucm0001.hw:Audio,2"
			CapturePriority 300
			JackControl "Mic - Input Jack"
			PlaybackCTL "_ucm0001.hw:Audio"
			TQ HiFi
		}
	}
}
Verb."HiFi 5+1" {
	Comment "HiFi 5.1 channels"
	Device.Speaker {
		Comment Speakers
		Values {
			CaptureCTL "_ucm0001.hw:Audio"
			JackControl "Speaker - Output Jack"
			PlaybackCTL "_ucm0001.hw:Audio"
			PlaybackChannels 6
			PlaybackMixerElem PCM,0
			PlaybackPCM "_ucm0001.hw:Audio"
			PlaybackPriority 200
			TQ HiFi
		}
	}
	Device.Headphones {
		Comment "Front Headphones"
		Values {
			CaptureCTL "_ucm0001.hw:Audio"
			JackControl "Headphone - Output Jack"
			PlaybackCTL "_ucm0001.hw:Audio"
			PlaybackMixerElem PCM,1
			PlaybackPCM "_ucm0001.hw:Audio,1"
			PlaybackPriority 300
			TQ HiFi
		}
	}
	Device.SPDIF {
		Comment "S/PDIF Output"
		Values {
			CaptureCTL "_ucm0001.hw:Audio"
			PlaybackCTL "_ucm0001.hw:Audio"
			PlaybackMixerElem PCM,2
			PlaybackPCM "_ucm0001.hw:Audio,2"
			PlaybackPriority 100
			TQ HiFi
		}
	}
	Device.Line1 {
		Comment "Line Input"
		Values {
			CaptureCTL "_ucm0001.hw:Audio"
			CaptureMixerElem Line,0
			CapturePCM "_ucm0001.hw:Audio,1"
			CapturePriority 100
			JackControl "Line - Input Jack"
			PlaybackCTL "_ucm0001.hw:Audio"
			TQ HiFi
		}
	}
	Device.Mic1 {
		Comment Microphone
		Values {
			CaptureCTL "_ucm0001.hw:Audio"
			CaptureMixerElem Mic,0
			CapturePCM "_ucm0001.hw:Audio,2"
			CapturePriority 300
			JackControl "Mic - Input Jack"
			PlaybackCTL "_ucm0001.hw:Audio"
			TQ HiFi
		}
	}
}
Verb."HiFi 7+1" {
	Comment "HiFi 7.1 channels"
	Device.Speaker {
		Comment Speakers
		Values {
			CaptureCTL "_ucm0001.hw:Audio"
			JackControl "Speaker - Output Jack"
			PlaybackCTL "_ucm0001.hw:Audio"
			PlaybackChannels 8
			PlaybackMixerElem PCM,0
			PlaybackPCM "_ucm0001.hw:Audio"
			PlaybackPriority 200
			TQ HiFi
		}
	}
	Device.Headphones {
		Comment "Front Headphones"
		Values {
			CaptureCTL "_ucm0001.hw:Audio"
			JackControl "Headphone - Output Jack"
			PlaybackCTL "_ucm0001.hw:Audio"
			PlaybackMixerElem PCM,1
			PlaybackPCM "_ucm0001.hw:Audio,1"
			PlaybackPriority 300
			TQ HiFi
		}
	}
	Device.SPDIF {
		Comment "S/PDIF Output"
		Values {
			CaptureCTL "_ucm0001.hw:Audio"
			PlaybackCTL "_ucm0001.hw:Audio"
			PlaybackMixerElem PCM,2
			PlaybackPCM "_ucm0001.hw:Audio,2"
			PlaybackPriority 100
			TQ HiFi
		}
	}
	Device.Line1 {
		Comment "Line Input"
		Values {
			CaptureCTL "_ucm0001.hw:Audio"
			CaptureMixerElem Line,0
			CapturePCM "_ucm0001.hw:Audio,1"
			CapturePriority 100
			JackControl "Line - Input Jack"
			PlaybackCTL "_ucm0001.hw:Audio"
			TQ HiFi
		}
	}
	Device.Mic1 {
		Comment Microphone
		Values {
			CaptureCTL "_ucm0001.hw:Audio"
			CaptureMixerElem Mic,0
			CapturePCM "_ucm0001.hw:Audio,2"
			CapturePriority 300
			JackControl "Mic - Input Jack"
			PlaybackCTL "_ucm0001.hw:Audio"
			TQ HiFi
		}
	}
}

But the alsamixer still looks the same there. Is there some need to reboot or restart alsa?

Reboot and use pulseaudio / pipewire server. There is no difference in the alsamixer - UCM is a higher level.

Where can I run pulseaudio / pipewire server?

So alsamixer will be replaced?

The sound server is usually used in the GUI now. If you use pavucontrol, you should see all inputs/outputs now with streams and assigned volume control. The alsamixer is the direct ALSA mixer application which can control the "bottom" things (volume controls) directly.

For USB devices, the mixer controls are described by USB descriptors. If the hardware vendor does not describe those controls in detail, you may see "PCM 1", "PCM 2" controls there. But it's hidden thing in pavucontrol (sound server) when the UCM is used.

In other words, direct ALSA API may use different abstraction than sound servers.

I tested here in a new installation of Ubuntu 22.10 and it worked!!! Since there is already the alsa-lib 1.2.7, it was possible to run this that you sent and, after restarting the PC, the front headphones worked normally. But indeed alsamixer doesn't show it. But it appears on gnome-control-center as front headphones, as it should be.

Thank you so much! Do you know why some apps (like the newest version of MuseScore, for example) cannot change their output? These are also not listed in pavucontrol, for example.

I could also manage to make them work on Ubuntu 22.04 with the native alsa-lib 1.2.6. I installed Cadence JACK server and opened it. Then I activated Duplex Mode and selected as Output Device hw:Audio, 1 [USB Audio]. Then I hit OK and started the JACK server. On the sound server (pavucontrol or gnome-control-center or any other), I selected the JACK sink as output. Then, all the sound applications for which I don't configure this on themselves, will route to the "system default", which will go to hw:1.