pop-os / pipewire

Packaging fork
https://gitlab.freedesktop.org/pipewire/pipewire
Other
8 stars 3 forks source link

alsactl restore is not restoring volume for some devices #32

Open le-patenteux opened 2 years ago

le-patenteux commented 2 years ago

Distribution: NAME="Pop!_OS" VERSION="22.04 LTS" ID=pop ID_LIKE="ubuntu debian" PRETTY_NAME="Pop!_OS 22.04 LTS" VERSION_ID="22.04" HOME_URL="https://pop.system76.com" SUPPORT_URL="https://support.system76.com" BUG_REPORT_URL="https://github.com/pop-os/pop/issues" PRIVACY_POLICY_URL="https://system76.com/privacy" VERSION_CODENAME=jammy UBUNTU_CODENAME=jammy LOGO=distributor-logo-pop-os

Related Application and/or Package Version: Audio at the kernel level, alsamixer

Issue/Bug Description: When using external USB audio interfaces (in my case the Behringer UMC204HD) audio level is lowered to 30% at the kernel level after every reboot. All levels in the GUI are at 100% and it does not help.

Only way to raise the volume is to use alsamixer in the terminal and fixes the issue.

I have helped several people reporting the same issue with other models/brands of interface.

Steps to reproduce (if you know): Own a USB audio Interface, reboot and be stuck with low output volume (other audio syncs are not showing that behaviour)

Expected behavior: Kernel audio levels should always be at 100% and adjusted through the audio server (pipewire in the case of Pop!OS)

Other Notes: I love Pop!OS, you people are awesome. You made my computing world better!

le-patenteux commented 2 years ago

Is it legal to "bump" an issue after 2 month that it was not noticed? It is a real annoyance and affects some of my coworkers too...

n3m0-22 commented 2 years ago

This will take further investigation, but I can confirm on a USB audio interface the volume level is being lowered between reboots. Thank you for bringing this to our attention.

n3m0-22 commented 1 year ago

@Normand-Nadon Updates to pipewire and wireplumber have been released. This has resolved the issue for me. After running an update please let me know if this fixes it for you.

n3m0-22 commented 1 year ago

There will be another update to pipewire #38 soon that I have tested, and I am still no longer seeing this problem.

I'm closing this issue for now, but can always reopen if you are still having a problem.

le-patenteux commented 1 year ago

@n3m0-22

I am sorry for the delay, for some reason github won't send me emails when someone answers to an issue I created

I updated my system and this issue still persists

pipewire --version is giving me this:

Compiled with libpipewire 0.3.66
Linked with libpipewire 0.3.66
n3m0-22 commented 1 year ago

I'm still unable to reproduce this issue. It seems to be hardware specific to Behringer. After a bit of searching I have found other reports for similar devices. The one common theme is that Behringer does not play nice with pipewire, at least out of the box. I'm including a few links that may be of some help, but without a Behringer UMC204HD to test on I can't say for certain.

https://gitlab.freedesktop.org/pipewire/pipewire/-/issues/2765 https://www.reddit.com/r/linuxaudio/comments/sim11g/behringer_umc202hd_choppy_audio/ https://nandakumar.org/blog/2022/02/umc202hd-linux.html

le-patenteux commented 1 year ago

@n3m0-22 , first-off, thank you for re-opening this issue... I am really a noob with Github and did not know if someone would get my message from a closed issue! (we have our own private versioning server at work, we don't use public instances)

If I can be of any assistance, just tell me what I can do to help. (tests, weird commands, logs)

The symptoms are as follow: when I reboot the PC, the levels for the interface are reverted to 30% in ALSA directly... Pipewire does not affect this level when increasing/decreasing the volume...» I need to open a terminal, type alsamixer, then F6 to select the source and put the levels back to 100% where pipewire can then adjust it later down the chain

n3m0-22 commented 1 year ago

@Normand-Nadon Before we try anything else, updates to the kernel and pipewire have just been release. It would be good to know first if they resolve this issue.

le-patenteux commented 1 year ago

I do a simple "apt update" and "apt upgrade" ? Or do I need to manually chose a kernel and Pipewire version?

In other words, is the package manager in Pop!_OS aware of the new versions?

n3m0-22 commented 1 year ago

Yes sudo apt update && sudo apt upgrade then reboot since the kernel is being updated. After reboot you can run apt policy pipewire and uname -r the results should be as follows.

apt policy pipewire

pipewire:
  Installed: 0.3.67~1678985654~22.04~e2b5db7
  Candidate: 0.3.67~1678985654~22.04~e2b5db7
  Version table:
 *** 0.3.67~1678985654~22.04~e2b5db7 1002
       1001 http://apt.pop-os.org/release jammy/main amd64 Packages
       1002 http://apt.pop-os.org/staging/master jammy/main amd64 Packages
       1002 http://apt.pop-os.org/staging/pipewire-0.3.67 jammy/main amd64 Packages
        100 /var/lib/dpkg/status
     0.3.48-1ubuntu3 500
        500 http://apt.pop-os.org/ubuntu jammy-updates/main amd64 Packages
     0.3.48-1ubuntu1 500
        500 http://apt.pop-os.org/ubuntu jammy/main amd64 Packages

uname -r

6.2.6-76060206-generic
le-patenteux commented 1 year ago

I updated everything:

Kernel:
6.2.6-76060206-generic
pipewire:
  Installé : 0.3.67~1678985654~22.04~e2b5db7
  Candidat : 0.3.67~1678985654~22.04~e2b5db7

It did not help (well ,in fact, I gained 1% on the dials! :D ... It used to be 30%, now it is 31%... )

image

n3m0-22 commented 1 year ago

Try the following:

If the desired volume level is not restored:

If the volume level is still not restored:


If at this point it is still not working can you share the output of:

le-patenteux commented 1 year ago

It does not fully work

sudo alsactl restore does restore the config, but it does not execute automatically on reboot

I can make a script that does it on boot, but that would not fix the underlying issue...It would just patch it.

Here is the result of journalctl:

mar 22 17:26:25 LN-T14-20UE-001 kernel: usb 2-2.4: Product: UMC204HD 192k
mar 22 17:26:25 LN-T14-20UE-001 kernel: usb 2-2.4: Manufacturer: BEHRINGER
mar 22 17:26:25 LN-T14-20UE-001 kernel: snd_hda_intel 0000:07:00.1: enabling device (0000 -> 0002)
mar 22 17:26:25 LN-T14-20UE-001 kernel: snd_hda_intel 0000:07:00.1: Handle vga_switcheroo audio client
mar 22 17:26:25 LN-T14-20UE-001 kernel: snd_hda_intel 0000:07:00.6: enabling device (0000 -> 0002)
mar 22 17:26:25 LN-T14-20UE-001 kernel: snd_hda_intel 0000:07:00.1: bound 0000:07:00.0 (ops amdgpu_dm_audio_component_bind_ops [amdgpu])
mar 22 17:26:25 LN-T14-20UE-001 kernel: input: HD-Audio Generic HDMI/DP,pcm=3 as /devices/pci0000:00/0000:00:08.1/0000:07:00.1/sound/card0/input18
mar 22 17:26:25 LN-T14-20UE-001 kernel: input: HD-Audio Generic HDMI/DP,pcm=7 as /devices/pci0000:00/0000:00:08.1/0000:07:00.1/sound/card0/input19
mar 22 17:26:25 LN-T14-20UE-001 kernel: input: HD-Audio Generic HDMI/DP,pcm=8 as /devices/pci0000:00/0000:00:08.1/0000:07:00.1/sound/card0/input20
mar 22 17:26:25 LN-T14-20UE-001 kernel: snd_hda_codec_realtek hdaudioC2D0: autoconfig for ALC257: line_outs=1 (0x14/0x0/0x0/0x0/0x0) type:speaker
mar 22 17:26:25 LN-T14-20UE-001 kernel: snd_hda_codec_realtek hdaudioC2D0:    speaker_outs=0 (0x0/0x0/0x0/0x0/0x0)
mar 22 17:26:25 LN-T14-20UE-001 kernel: snd_hda_codec_realtek hdaudioC2D0:    hp_outs=1 (0x21/0x0/0x0/0x0/0x0)
mar 22 17:26:25 LN-T14-20UE-001 kernel: snd_hda_codec_realtek hdaudioC2D0:    mono: mono_out=0x0
mar 22 17:26:25 LN-T14-20UE-001 kernel: snd_hda_codec_realtek hdaudioC2D0:    inputs:
mar 22 17:26:25 LN-T14-20UE-001 kernel: snd_hda_codec_realtek hdaudioC2D0:      Mic=0x19
mar 22 17:26:25 LN-T14-20UE-001 kernel: input: HD-Audio Generic Mic as /devices/pci0000:00/0000:00:08.1/0000:07:00.6/sound/card2/input23
mar 22 17:26:25 LN-T14-20UE-001 kernel: input: HD-Audio Generic Headphone as /devices/pci0000:00/0000:00:08.1/0000:07:00.6/sound/card2/input24

And the output of the systemctl command: image

n3m0-22 commented 1 year ago

Can you also share the output of amixer --card=1

le-patenteux commented 1 year ago

There:

Simple mixer control 'PCM',0
  Capabilities: pvolume pvolume-joined pswitch pswitch-joined
  Playback channels: Mono
  Limits: Playback 0 - 60
  Mono: Playback 58 [97%] [-2.00dB] [on]
Simple mixer control 'Mic',0
  Capabilities: cvolume cvolume-joined pswitch pswitch-joined
  Playback channels: Mono
  Capture channels: Mono
  Limits: Capture 0 - 24
  Mono: Playback [off] Capture 14 [58%] [14.00dB]

If it can help, this is the order in which my devices appear in alsamixer image

le-patenteux commented 1 year ago

I figured you would also want the output for card number 5!

Simple mixer control 'Mic',0
  Capabilities: cvolume cswitch
  Capture channels: Front Left - Front Right
  Limits: Capture 0 - 127
  Front Left: Capture 127 [100%] [0.00dB] [on]
  Front Right: Capture 127 [100%] [0.00dB] [on]
Simple mixer control 'Mic',1
  Capabilities: cvolume cvolume-joined cswitch cswitch-joined
  Capture channels: Mono
  Limits: Capture 0 - 127
  Mono: Capture 127 [100%] [0.00dB] [on]
Simple mixer control 'UMC204HD 192k Output',0
  Capabilities: pvolume pswitch
  Playback channels: Front Left - Front Right - Rear Left - Rear Right
  Limits: Playback 0 - 127
  Mono:
  Front Left: Playback 97 [76%] [-30.00dB] [on]
  Front Right: Playback 97 [76%] [-30.00dB] [on]
  Rear Left: Playback 97 [76%] [-30.00dB] [on]
  Rear Right: Playback 97 [76%] [-30.00dB] [on]
Simple mixer control 'UMC204HD 192k Output',1
  Capabilities: pvolume pvolume-joined pswitch pswitch-joined
  Playback channels: Mono
  Limits: Playback 0 - 127
  Mono: Playback 127 [100%] [0.00dB] [on]
le-patenteux commented 1 year ago

@n3m0-22 If you want me to join a live conversation somewhere so that you don't have to wait for my answers all the time, just tell me where! Discord, Rocket-Chat, Signal, MIRC, Yahoo, ICQ ! Just tell me!

(Since my issue is taking care of, I want to make sure I make myself available to participate!)

n3m0-22 commented 1 year ago

I may have a solution for you. I was able to reproduce this with a USB audio Interface. This is what worked for me.

I think it's best we keep this discussion on here. That way anyone else experiencing the issue can find it. That being said if you ever need further support you can also reach out on Mattermost. If you go to Settings>Support click on Join. I would suggest asking for help in the support or general channels. You can also ping me on Mattermost with @randall.

le-patenteux commented 1 year ago

Good new, progress was made! Not fixed, but cause might be foud!

So, using pavucontrol (I already had it installed, just never noticed what I am about to explain), I realized that the sound Interface, at least in linux, acts as if it were multiple unrelated devices (I mean, that is what it seems to me)

By default, the "Direct output" is used... alsa_01

Direct Output has a single dial for volume (and that is to be expected): image

It is in fact where I am connected on the device itself, because this output can be physically bound the the Headphones output, which is what I want in most cases : image

Possible culprit

For some reasons I dont understand, on Linux, the direct output is bound to Output A or B in software depending on my selection on the device itself (Monitor A/B) This should not be, because A and B are separate lines on the device... There should be 3 independent volume controls for those 3 outputs

Once the volume of A or B has been reset to 100%, the Direct output acts as a master volume over A and B... That is not how it should be! A/B button should only act on the headphones, not the rear outputs

Now the weird part:

When setting the interface to "Default" in pavucontrol image

Output A and B "remember" to set themselves back to 100% (or whatever was the last value when I shut down) like nothing happened image

On Windows

This behavior is different on Windows (we have the same interface at work on another machine):

Conclusion?

My guess is that there is an issue in how ALSA treats this device... Might not be related to Pop!_OS directly... (have to test on other distros to confirm)

Can you help me find how to investigate this issue further?

n3m0-22 commented 1 year ago

Thanks for all the new info. I'm continuing to research this issue. I'll update you when I have more.

chmaha commented 1 year ago

On Debian 12, on reboot my UMC202HD always defaulted to 40% volume in alsamixer. As suggested, setting the profile to "default" in pavucontrol seems to have fixed things for me. There doesn't seem a need to use the "Pro Audio" profile for this interface.

chmaha commented 1 year ago

And strangely, while this solves the reboot issue, logging out then logging back in doesn't respect the value and returns to 40%!

mmstick commented 1 year ago

Perhaps this issue should be moved to pop-os/pop or pop-os/linux since it's not related to pipewire itself. ALSA is a component of the Linux kernel and alsactl is a separate program. May be better to file issues to the kernel's bug reporting mailing lists for these particular ALSA driver issues.

31337-4554551n commented 9 months ago

I'd like to chime in and show my interest. I have a similar issue-a USB C dongle with a 3.5m jack. Every time I reboot I lose volume and have to use alsamixer to set it back to 100 each time. Also pop OS. Device is detected automatically, and the volume in the gui shows 100%, and moving that volume up and down doesn't do anything until I set it to high in alsamixer.

I'll add this doesn't only happen on reboot, but any time the usb c dock is connected or disconnected

le-patenteux commented 9 months ago

One behavior I noted is that if the interface is NOT connected when booting, and connected later, the issue does not exist. Volume in ALSA is at 100% and volume can be controlled via the Pop!OS volume control as expected.

If I boot-up the PC with the interface attached to it, the issue comes back and volume defaults to 30% in alsamixer

On Debian 12, on reboot my UMC202HD always defaulted to 40% volume in alsamixer. As suggested, setting the profile to "default" in pavucontrol seems to have fixed things for me. There doesn't seem a need to use the "Pro Audio" profile for this interface.

I will try that and report back!