4

I just set up pc with MSI mag z590. it has RealtekĀ® ALC4080 Codec. The headset jack which placed the front panel does not work. I search for old questions. I found this closest question. Unfortunately, there is no answer. A headset is defined on my sound settings but the sound does not come. my kernel 5.11.0-43-generic and ubuntu ver 20.04 LTS. I can get sound with a Bluetooth headset.

3 Answers3

5

Update: Once my Ubuntu has updated the alsa package to version 1.2.8 (check with the command alsaucm --version) I was able to make my card work just by installing alsa-ucm-conf version 1.2.10 with the instructions they provided in this README. Remember to run the tar xvzf command from the instructions with sudo. Once you are done, reboot, enjoy!

I had the same issue and fixed it with the latest alsa UCM configuration. The alsa UCM configuration comes from the alsa-ucm-conf package. Updates to the alsa-ucm-conf package will wipeout the modifications you are doing here, so make backups and keep notes of what worked so you can easily restore your changes after eventual updates to alsa-ucm-conf. My fix is very similar to the other one that's listed here, however it manages to avoid the need to install a new version of alsa-lib. Other people landing here should know that it also depends on the motherboard you have, but I'll cover that as well. The ALC4080 chipset appears as a USB Audio device, so keep that in mind.

Now look at the file ucm2/USB-Audio/USB-Audio.conf specifically at the If.realtek-alc4080 block (delimited by the outside braces). If you see your motherboard in the comments, great! You can just use the block as is and skip the next step.

If you don't see your motherboard, don't worry, we'll still get it working. Run the following command:

    lsusb

You'll need to extract from there the id of your USB Audio card. It's different on every motherboard. Here's what mine looks like:

    Bus 001 Device 002: ID 42ab:4a5c ASUSTek Computer, Inc. USB Audio

So mine is 42ab:4a5c. Remember to look for the line that contains "USB Audio". If you see multiple lines with USB Audio, you might have some USB headset or audio device, unplug it then try again.

Now edit /usr/share/alsa/ucm2/USB-Audio/USB-Audio.conf on your system (save a backup before doing it to be on the safe side) and add the entire If.realtek-alc4080 block from ucm2/USB-Audio/USB-Audio.conf including the If.realtek-alc4080 text to your USB-Audio.conf file.

If you're motherboard is not listed, replace the entire line starting with Regex "USB(..." with Regex "USB<your usb id from lsusb>". So for my motherboard it would be Regex "USB42ab:4a5c"

Then copy ALC4080.conf and ALC4080-HiFi.conf to /usr/share/alsa/ucm2/USB-Audio/Realtek/ALC4080.conf and /usr/share/alsa/ucm2/USB-Audio/Realtek/ALC4080-HiFi.conf respectively.

What you are doing copying these files is basically providing alsa with the configuration necessary to understand how to communicate with the ALC4080 chipset.

Now we have to figure out if your alsa's libraries can understand these configuration files. These steps are necessary because the syntax used in these files is "new" syntax (syntax 6 apparently) which only newer alsa libs can understand (I don't know exactly which version). Lets try to load this new configuration and see if it works.

    alsaucm -i
    open USB-Audio
    listcards

The command alsaucm -i takes you to the interactive mode of alsaucm. Then with open USB-Audio you are telling it to try and load configuration for USB Audio. If at this point you get errors, we'll need to edit the configuration files to take out the syntax it cannot understand. If you get no errors and see some nice output after running listcards, congratulations, restart and try out your Audio capabilities.

If however you get errors, you'll need to edit /usr/share/alsa/ucm2/USB-Audio/Realtek/ALC4080.conf and replace everything with

    Comment "USB-audio on Realtek ALC4080"
    SectionUseCase."HiFi" {
        File "/USB-Audio/Realtek/ALC4080-HiFi.conf"
        Comment "HiFi 2.0 Channels"
    }
    # SectionUseCase."HiFi 5+1" {
    #   File "/USB-Audio/Realtek/ALC4080-HiFi.conf"
    #   Comment "HiFi 5.1 channels"
    # }
    # SectionUseCase."HiFi 7+1" {
    #   File "/USB-Audio/Realtek/ALC4080-HiFi.conf"
    #   Comment "HiFi 7.1 channels"
    # }

This is my attempt at translating to the old syntax style. You also need to edit /usr/share/alsa/ucm2/USB-Audio/Realtek/ALC4080-HiFi.conf and remove the 2 lines that start with Variant."HiFi.....

Now, if you've been paying attention you've probably noticed that ALC4080 has 3 operating modes. These operating modes are describe in my motherboard manual, the 3 operating modes are either 2.0 channels, or 5+1 or 7+1. In future versions of the alsa-ucm-conf these will work separately. But right now we'll have to hardcode one of those modes. In case you are just using your headset, you can skip changing the PlaybackChannels and move to the validation step below. In case you are using 5+1 you'll need to replace the PlaybackChannels 2 line with PlaybackChannels 6 and if you are using 7+1, then you'll have to replace it with PlaybackChannels 8. You can also do this by commenting/uncommenting lines (a comment starts with #) as it was done in the new ALC4080.conf above. You may also comment/uncomment the appropriate section for you in ALC4080.conf above if you want to see the appropriate title, although it is not strictly necessary. Unfortunately I don't know this format well enough to provide a solution for all 3 modes of operation. So if you want to switch between them, you'll need to edit these files appropriately and restart your computer.

Now let's try again to validate the configuration. Run these again

    alsaucm -i
    open USB-Audio
    listcards

You should not get any errors and upon running listcards you should see a card listed, probably called "Generic USB Audio". This should finally work now. Restart and check to see if it works.

2

I had and fixed the the same issue, and tl;dr you're probably better off waiting for the latest alsa version to make it into a stable ubuntu repo than trying to fix it now.
If you want to fix it now, here's what I did:

  • First, you can rule out wiring & codec issues by playing audio directly through aplay (source):

    aplay -D plughw:Audio,1 /usr/share/sounds/alsa/Front_Left.wav
    
  • Once you have verified that, you can look at the latest USB-Audio config in the alas-ucm-conf repo for your board. lsusb | grep -i audio will also help you find the exact USB ID and match it to the regex there, as will various related GH issues

  • Then you have to somehow get the latest config + a version of alsa-lib that can parse it.
    The former is easy - just clone the repo, checkout master or 1.2.7.2, and run the following from the root of the repo:

    git clone https://github.com/alsa-project/alsa-ucm-conf && cd alsa-ucm-conf
    # git checkout 1.2.7.2 if you don't want master
    # take a a backup
    sudo mv /usr/share/alsa/ucm2 /usr/share/alsa/ucm2_bak/
    # link ucm2 config to the shared config dir
    sudo ln -s `pwd`/ucm2 /usr/share/alsa/ucm2
    
  • Installing a version of alsa-lib that can actually parse the config is more tedious, which is why I recommend waiting. Probably best to build from source (not what I did, see 1).

  • Finally, once you have both the config and a version of the library that can parse it:

    alsaucm reload
    pulseaudio -k && pulseaudio -D
    

Hope that all helps.

1: Instead of building from source, I didn't know what I was doing, so I naively added bookworm to my /etc/apt/sources.list so I could get alsa-utils 1.2.7.1, which somehow broke my DNS resolver so I strongly recommend not doing this. Again, probably installing from source is the way to go but I haven't seen any advice on how to do so.

micimize
  • 121
0

I have been wrestling with the same problem in the past few days on my newly built PC. Finally resolved it and wanted to post what works for me just in case it might help others. To fix the output problem, follow https://github.com/alsa-project/alsa-ucm-conf/issues/394 and modify the USB-Audio.conf file to add your USB address in the regex expression such that it's recognized. This is what the other answer does as well. To fix the mic being too quiet, the only thing that worked for me on Ubuntu 24.04 is:

sudo apt install wireplumber

wpctl status # To see available devices wpctl set-volume @DEFAULT_SOURCE@ 1.5 # Set mic volume to 150%

Lulu Liu
  • 1
  • 1